Skip to content
Permalink
Browse files

upload: early return when no files to upload

  • Loading branch information
nilslice committed Nov 30, 2019
1 parent c3d75b7 commit 45730ba5b4de56fed27f79f8c822bb59d41f7a38
Showing with 6 additions and 2 deletions.
  1. +6 −2 system/admin/upload/upload.go
@@ -31,11 +31,15 @@ func StoreFiles(req *http.Request) (map[string]string, error) {
ts = fmt.Sprintf("%d", int64(time.Nanosecond)*time.Now().UnixNano()/int64(time.Millisecond)) // Unix() returns seconds since unix epoch
}

req.Form.Set("timestamp", ts)

// To use for FormValue name:urlPath
urlPaths := make(map[string]string)

if len(req.MultipartForm.File) == 0 {
return urlPaths, nil
}

req.Form.Set("timestamp", ts)

// get or create upload directory to save files from request
pwd, err := os.Getwd()
if err != nil {

0 comments on commit 45730ba

Please sign in to comment.
You can’t perform that action at this time.