Skip to content

Commit

Permalink
minor: added some log output for HereSphere file deletes (xbapps#1473)
Browse files Browse the repository at this point in the history
Co-authored-by: crwxaj <crwxaj>
  • Loading branch information
crwxaj authored Nov 5, 2023
1 parent 98b72a0 commit 506c357
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/api/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 3 additions & 1 deletion pkg/api/heresphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}
Expand All @@ -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")
Expand Down

0 comments on commit 506c357

Please sign in to comment.