Skip to content

Commit 1f36d35

Browse files
committed
Upload: Report successful number of files in users_upload.go photoprism#4895
Signed-off-by: Michael Mayer <michael@photoprism.app>
1 parent 3acd410 commit 1f36d35

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

internal/api/users_upload.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ func UploadUserFiles(router *gin.RouterGroup) {
7474
event.Publish("upload.start", event.Data{"uid": s.UserUID, "time": start})
7575

7676
files := f.File["files"]
77-
uploaded := len(files)
7877

7978
var uploads []string
8079

@@ -98,15 +97,9 @@ func UploadUserFiles(router *gin.RouterGroup) {
9897

9998
if fileType == fs.TypeUnknown {
10099
log.Warnf("upload: rejected %s due to unknown or unsupported extension", clean.Log(fileName))
101-
if err = os.Remove(filePath); err != nil {
102-
log.Errorf("upload: %s could not be deleted (%s)", clean.Log(fileName), err)
103-
}
104100
continue
105101
} else if allowExt.Excludes(fileType.DefaultExt()) {
106102
log.Warnf("upload: rejected %s because the file type is not allowed", clean.Log(fileName))
107-
if err = os.Remove(filePath); err != nil {
108-
log.Errorf("upload: %s could not be deleted (%s)", clean.Log(fileName), err)
109-
}
110103
continue
111104
}
112105

@@ -159,7 +152,7 @@ func UploadUserFiles(router *gin.RouterGroup) {
159152

160153
elapsed := int(time.Since(start).Seconds())
161154

162-
msg := i18n.Msg(i18n.MsgFilesUploadedIn, uploaded, elapsed)
155+
msg := i18n.Msg(i18n.MsgFilesUploadedIn, len(uploads), elapsed)
163156

164157
log.Info(msg)
165158

0 commit comments

Comments
 (0)