mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
[Files Refactor] Bug fixes (#2868)
* Return error if multiple rows returned for id * Add missing LoadFiles calls * Show id if path is empty
This commit is contained in:
@@ -81,6 +81,10 @@ func (s *Service) destroyImage(ctx context.Context, i *models.Image, fileDeleter
|
||||
|
||||
// deleteFiles deletes files for the image from the database and file system, if they are not in use by other images
|
||||
func (s *Service) deleteFiles(ctx context.Context, i *models.Image, fileDeleter *FileDeleter) error {
|
||||
if err := i.LoadFiles(ctx, s.Repository); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, f := range i.Files.List() {
|
||||
// only delete files where there is no other associated image
|
||||
otherImages, err := s.Repository.FindByFileID(ctx, f.ID)
|
||||
|
||||
@@ -159,7 +159,7 @@ func (h *ScanHandler) associateExisting(ctx context.Context, existing []*models.
|
||||
}
|
||||
|
||||
if !found {
|
||||
logger.Infof("Adding %s to image %s", f.Path, i.GetTitle())
|
||||
logger.Infof("Adding %s to image %s", f.Path, i.DisplayName())
|
||||
|
||||
// associate with folder-based gallery if applicable
|
||||
if h.ScanConfig.GetCreateGalleriesFromFolders() {
|
||||
|
||||
Reference in New Issue
Block a user