Skip to content

Commit

Permalink
Fix thumbnails not moving to the correct place
Browse files Browse the repository at this point in the history
  • Loading branch information
rigon committed Feb 18, 2025
1 parent 369aa95 commit c14cdb4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions server/organize.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,13 @@ func (srcAlbum *Album) MovePhotos(mode string, srcCollection *Collection, dstCol
// Move thumbnail
srcThumbPath := photo.src.ThumbnailPath(srcCollection)
dstThumbPath := photo.dst.ThumbnailPath(dstCollection)
err := os.Rename(srcThumbPath, dstThumbPath)
if err != nil { // If not possible to rename, remove thumbnail for cleanup
os.Remove(srcThumbPath)
// Ensure the directories exist
if err := os.MkdirAll(filepath.Dir(dstThumbPath), os.ModePerm); err == nil {
err := os.Rename(srcThumbPath, dstThumbPath)
if err != nil { // If not possible to rename, remove thumbnail for cleanup
os.Remove(srcThumbPath)
}
}

// Move photo info
srcCollection.cache.DeletePhotoInfo(photo.src)
dstCollection.cache.AddPhotoInfo(photo.dst)
Expand Down

0 comments on commit c14cdb4

Please sign in to comment.