diff options
author | Steve Manuel <nilslice@gmail.com> | 2019-11-29 19:18:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-29 19:18:30 -0700 |
commit | 45730ba5b4de56fed27f79f8c822bb59d41f7a38 (patch) | |
tree | 63ed7668566eca184128ac4e1da29e83e30fc2b1 /system/admin/upload | |
parent | c3d75b78c954d21ff8baf395f9b4beabeecd0af9 (diff) |
upload: early return when no files to upload
Diffstat (limited to 'system/admin/upload')
-rw-r--r-- | system/admin/upload/upload.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/system/admin/upload/upload.go b/system/admin/upload/upload.go index a0568e4..fd29796 100644 --- a/system/admin/upload/upload.go +++ b/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 { |