File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
routers/api/packages/swift Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -306,16 +306,20 @@ func UploadPackageFile(ctx *context.Context) {
306306
307307 var file io.ReadCloser
308308 multipartFile , _ , err := ctx .Req .FormFile ("source-archive" )
309- if err != nil {
309+ if err != nil && ! errors .Is (err , http .ErrMissingFile ) {
310+ apiError (ctx , http .StatusBadRequest , err )
311+ return
312+ }
313+
314+ if multipartFile != nil {
315+ file = multipartFile
316+ } else {
310317 content := ctx .Req .FormValue ("source-archive" )
311- if content != "" {
312- file = io .NopCloser (strings .NewReader (content ))
313- } else {
314- apiError (ctx , http .StatusBadRequest , err )
318+ if content == "" {
319+ apiError (ctx , http .StatusBadRequest , "source-archive is required either as file or form value" )
315320 return
316321 }
317- } else {
318- file = multipartFile
322+ file = io .NopCloser (strings .NewReader (content ))
319323 }
320324 defer file .Close ()
321325
You can’t perform that action at this time.
0 commit comments