From 506c3578695c1d8bd1edc2a6cefde742cab26553 Mon Sep 17 00:00:00 2001 From: crwxaj <52156245+crwxaj@users.noreply.github.com> Date: Sun, 5 Nov 2023 15:39:53 +0100 Subject: [PATCH] minor: added some log output for HereSphere file deletes (#1473) Co-authored-by: crwxaj --- pkg/api/files.go | 1 + pkg/api/heresphere.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/api/files.go b/pkg/api/files.go index 7e3e2a16c..4d41e7d33 100644 --- a/pkg/api/files.go +++ b/pkg/api/files.go @@ -323,6 +323,7 @@ func removeFileByFileId(fileId uint) models.Scene { err := db.Preload("Volume").Where(&models.File{ID: fileId}).First(&file).Error if err == nil { + log.Infof("Deleting file %s", filepath.Join(file.Path, file.Filename)) deleted := false switch file.Volume.Type { case "local": diff --git a/pkg/api/heresphere.go b/pkg/api/heresphere.go index 0581a5fa2..e6fcd5975 100644 --- a/pkg/api/heresphere.go +++ b/pkg/api/heresphere.go @@ -238,6 +238,7 @@ func (i HeresphereResource) getHeresphereFile(req *restful.Request, resp *restfu Media: media, } if requestData.DeleteFiles != nil && config.Config.Interfaces.Heresphere.AllowFileDeletes { + log.Infof("Got request by HereSphere to delete file %v", file.Filename) removeFileByFileId(file.ID) } @@ -879,6 +880,7 @@ func ProcessHeresphereUpdates(scene *models.Scene, requestData HereSphereAuthReq } if requestData.DeleteFiles != nil && config.Config.Interfaces.Heresphere.AllowFileDeletes { + log.Infof("Got request by HereSphere to delete files for scene %v", scene.ID) for _, sceneFile := range scene.Files { removeFileByFileId(sceneFile.ID) } @@ -887,7 +889,7 @@ func ProcessHeresphereUpdates(scene *models.Scene, requestData HereSphereAuthReq if requestData.Hsp != nil && config.Config.Interfaces.Heresphere.AllowHspData { hspContent, err := base64.StdEncoding.DecodeString(*requestData.Hsp) if err != nil { - log.Error("Error decoding heresphere hsp data %v", err) + log.Errorf("Error decoding heresphere hsp data %v", err) } fName := filepath.Join(scene.Files[0].Path, strings.TrimSuffix(scene.Files[0].Filename, filepath.Ext(videoFile.Filename))+".hsp")