summaryrefslogtreecommitdiff
path: root/system/admin/upload/upload.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2019-11-29 19:18:30 -0700
committerGitHub <noreply@github.com>2019-11-29 19:18:30 -0700
commit45730ba5b4de56fed27f79f8c822bb59d41f7a38 (patch)
tree63ed7668566eca184128ac4e1da29e83e30fc2b1 /system/admin/upload/upload.go
parentc3d75b78c954d21ff8baf395f9b4beabeecd0af9 (diff)
upload: early return when no files to upload
Diffstat (limited to 'system/admin/upload/upload.go')
-rw-r--r--system/admin/upload/upload.go8
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 {