BUG: Removed subfolder comes back on next sync and kept subfolders lose favourites and albums

Open
#1,796 2 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 3 days

@Saurabhyadav0 is already working on this.

Since Nov 29, 2026.

  • #1799 by @Saurabhyadav0 — open

Assessment

This issue has not been assessed yet.

Description

bug enhancement
Is there an existing issue for this?
  • I have searched the existing issues
What happened?

Description

A subfolder removed from PictoPy comes back on the next sync of its parent folder. The subfolder that was kept is deleted and added again, so its photos lose their favourite mark and album membership.

Steps to reproduce

  1. Create main/X/Y with a photo in each folder, and add main to PictoPy.
  2. Favourite the photo in Y and add it to an album.
  3. In Settings, remove X and leave Also delete 1 subfolder unchecked.
  4. Copy a new photo into main and wait for the automatic sync.

Expected behavior

X stays removed. The photo in Y stays a favourite and stays in its album.

Actual behavior

  • X and its photo come back.
  • The photo in Y gets a new ID (56aac140 -> d1289525).
  • It is no longer a favourite, and the album drops from 1 photo to 0.

Cause

sync_folder (backend/app/routes/folders.py) compares the direct child folders on disk with those in the database. After X is removed, Y is attached to main. Sync then treats Y as obsolete (it is not a direct child on disk) and X as new, deletes Y, and adds X and Y again. Folders removed by the user are not remembered.

Suggested fix

Remember folders the user removed and skip them during sync, do not treat re-attached subfolders as obsolete, and add tests.

Screenshots

1. The photo in Y is a favourite
1-y-is-favourite
IMAGE-1

2. Removing X and keeping its subfolder
2-remove-X-keep-subfolder
IMAGE-2

3. X is removed
3-X-removed
IMAGE-3

4. After adding a photo to main, X is back
4-X-is-back
IMAGE-4

5. The favourite is gone
5-favourite-lost
IMAGE-5

Video:-
https://github.com/user-attachments/assets/8d289434-50a0-44c5-a772-0ca6cb511268

Log

== 1. After adding 'main', favouriting y.png and adding it to an album
folders: ['main', 'main/X', 'main/X/Y']
photo: main/X/Y/y.png     id=56aac140 favourite=True
photo: main/X/x.png       id=1c32e379 favourite=False
photo: main/main.png      id=852c1811 favourite=False
album photo counts: {'Demo Trip': 1}

== 2. After removing subfolder X in Settings, keeping its subfolder
folders: ['main', 'main/X/Y']
photo: main/X/Y/y.png     id=56aac140 favourite=True
photo: main/main.png      id=852c1811 favourite=False
album photo counts: {'Demo Trip': 1}

== 3. After copying new.png into 'main' (synced by the file watcher)
folders: ['main', 'main/X', 'main/X/Y']
photo: main/X/Y/y.png     id=d1289525 favourite=False
photo: main/X/x.png       id=063800a5 favourite=False
photo: main/main.png      id=852c1811 favourite=False
photo: main/new.png       id=f1c52cee favourite=False
album photo counts: {'Demo Trip': 0}

Environment

macOS, dev at e3d5a999. Reproduced with the local backend and file watcher. The UI was run in Chrome with a stand-in for the Tauri layer, so thumbnails are generated placeholders. Folder setup and file copies were scripted.

I would like to work on this if approved.

Record
  • I agree to follow this project's Code of Conduct
Dominant language
Python
Stars
322
Forks
793
Avg merge
6d 10h
Merged PRs (30d)
20

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AOSSIE-Org/PictoPy

All issues in AOSSIE-Org/PictoPy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.