API: Improve file operation logs
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
6dd55170fe
commit
e331fcf43f
2 changed files with 8 additions and 0 deletions
|
@ -2,6 +2,7 @@ package api
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/dustin/go-humanize/english"
|
||||
|
@ -382,6 +383,10 @@ func BatchPhotosDelete(router *gin.RouterGroup) {
|
|||
|
||||
// Delete photos.
|
||||
for _, p := range photos {
|
||||
// Report file deletion.
|
||||
event.AuditWarn([]string{ClientIP(c), s.UserName, "delete", path.Join(p.PhotoPath, p.PhotoName+"*")})
|
||||
|
||||
// Remove all related files from storage.
|
||||
n, err := photoprism.DeletePhoto(p, true, true)
|
||||
|
||||
numFiles += n
|
||||
|
|
|
@ -68,6 +68,9 @@ func DeleteFile(router *gin.RouterGroup) {
|
|||
return
|
||||
}
|
||||
|
||||
// Report file deletion.
|
||||
event.AuditWarn([]string{ClientIP(c), s.UserName, "delete", file.FileName})
|
||||
|
||||
// Remove file from storage.
|
||||
if err = mediaFile.Remove(); err != nil {
|
||||
log.Errorf("files: %s (delete %s from folder)", err, clean.Log(baseName))
|
||||
|
|
Loading…
Reference in a new issue