Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why I deleted selected albums and the photos still in the recent Album #890

Closed
sunosv opened this issue Jan 28, 2021 · 3 comments · Fixed by #898
Closed

Why I deleted selected albums and the photos still in the recent Album #890

sunosv opened this issue Jan 28, 2021 · 3 comments · Fixed by #898
Labels
bug Something isn't working High Priority High priority issues

Comments

@sunosv
Copy link

sunosv commented Jan 28, 2021

I tested it many times. This problem only happens in deleting Multi-selected albums.
Deleting albums one by one, photos in that album will be deleted. But when I deleted all albums together, lots of photos still in the recent Album. And I check "Photos" in the SQL, there also have the data of these photos. And a lot of photos also still in public/uploads/big.

Browser DevTools Network Album::delete Response is true.

Lychee logs show no error.

@ildyria
Copy link
Member

ildyria commented Jan 28, 2021

That is weird.

@ildyria ildyria added the bug Something isn't working label Jan 28, 2021
@kamil4 kamil4 added the High Priority High priority issues label Jan 30, 2021
@kamil4
Copy link
Contributor

kamil4 commented Jan 30, 2021

I looked into this and it's bad.

We look up all the albums passed as arguments to Album::Delete first, and then, for each of them one-by-one, we delete the photos inside, the (now empty) subalbums, and the (now really empty) album itself. The problem is that after we delete the first album, _lft and _rgt of remaining albums can change. So when we go on to delete the second album, we are going by the now obsolete _lft and _rgt. We can actually delete the contents of a wrong album! Create three sibling albums, multi-select the first two and delete them. The contents of the first and third will get deleted.

A workaround I can think of is looking up the albums passed as arguments to Album::Delete one-by-one, to ensure that we always get an up-to-date version. But maybe there's a better fix? Also, this is the second bug in delete we are seeing. Can any other operations then delete be affected by this?

@ildyria
Copy link
Member

ildyria commented Jan 30, 2021

I will fix it this weekend.

@ildyria ildyria mentioned this issue Jan 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working High Priority High priority issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants