Bug 512207 - Deleting files from disk adds them to the blocklist
Summary: Deleting files from disk adds them to the blocklist
Status: RESOLVED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: general (other bugs)
Version First Reported In: GIT master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-16 17:26 UTC by Andreas Schleth
Modified: 2026-02-08 22:49 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schleth 2025-11-16 17:26:38 UTC
SUMMARY
When deleting files from disk (from the KPA dialog), the files get added to the blocklist. But they shouldn't. Deleted from disk and deleted from the database should be enough. 

I do not know how often I  had to clear the blocklist manually with the editor (thanks for a human readable database!). This is a problem if I need to import the same images again (e.g. after some corrections in the original database).

I understand, that the blocklist is necessary to delete files from the database only.

STEPS TO REPRODUCE
**
** Do not follow these steps with valuable data, as it involves deleting files permanently. **
**
1. Inspect the index.xml file with a text editor and look at the <blocklist> and take note of the listed images (if any)
2. In thumbnail view select some images, take note of their file name and hit "DEL"
3. In the pop up dialog select "delete files from disk"
4. Save the database (close KPA)
5. Inspect the <blocklist>

OBSERVED RESULT
The deleted images appear in the blocklist

EXPECTED RESULT
The deleted images should not be in the blocklist

SOFTWARE/OS VERSIONS
KPhotoAlbum: v6.1.0-14-g3705a5703
KDE Frameworks: 6.17.0
Qt: Using 6.8.2 and built against 6.8.2
TUXEDO OS (Xcb)
Build ABI: x86_64-little_endian-lp64
Kernel: linux 6.14.0-115036-tuxedo

ADDITIONAL INFORMATION
Comment 1 Randall Rude 2025-12-05 17:56:32 UTC
Thank you for reporting this, Andreas.

So far I am unable to reproduce this with the demo.  However, I do see files in the blocklist in my personal album and I'm sure I didn't block them deliberately.

Are you able to reproduce this with the demo?
Comment 2 Andreas Schleth 2025-12-05 21:35:14 UTC
Hi Randall,

I just built a new KPA from git and cannot reproduce this issue with the demo and with one of my databases. 
However I had a lot images in the blocklist without intending to. Just checked another db with a longish blocklist - but most of the images in it were from 2018 or older. So that might be an issue from older KPA versions (?).

So ... I guess, we should close this as "not reproducible" - at least for now.

I also am quite sure, that I never deleted files from the database only - but who knows, maybe I failed to do a few times (??).

Thanks for looking into this.
Comment 3 Randall Rude 2025-12-06 16:15:20 UTC
That's good news!  I checked my backup archive and my blocklist is also quite old.  I will clean it up and watch for new entries.

Thank you for the additional testing.

Closing as not reproducible.
Comment 4 Randall Rude 2026-02-08 18:58:00 UTC
This happened to me again - files appeared in my real album's blocklist a few days ago.

Here is one way this can happen:
* start the demo, save, and quit.
* rm spiff.jpg from the /tmp demo folder.
* restart the demo, open the thumbnail view, select spiff.jpg and hit the Delete key.

Since the image file is missing, the only option enabled in the delete dialog is "block from database" which adds the file to the block list.

So this is as-designed.  The delete logic could be smarter and not block a file that doesn't exist, or maybe offer an additional option to simply forget the file in this case?  Perhaps kphotoalbum should provide a way for the user to view and edit the block list.
Comment 5 Johannes Zarl-Zierl 2026-02-08 22:49:05 UTC
Git commit 9e7cdfcd9df125b585d874492db89a0ef6e4a034 by Johannes Zarl-Zierl.
Committed on 08/02/2026 at 22:42.
Pushed by johanneszarl into branch 'master'.

Don't add nonexisting files to blocklist

Until now, any files to be removed from the database which were not
deleted or moved to trash were added to the block list.
In reality, this leads to the blocklist growing larger than needed. The
only reason to add files to the block list is when they are existing
files in the image directory that should be ignored. If the files are
not on disk (usually because they are deleted outside of kphotoalbum),
there's no need to prevent them from being re-added.

M  +10   -2    MainWindow/DeleteDialog.cpp
M  +1    -1    MainWindow/DuplicateMerger/DuplicateMerger.cpp
M  +10   -11   Utilities/DeleteFiles.cpp
M  +12   -1    Utilities/DeleteFiles.h

https://invent.kde.org/graphics/kphotoalbum/-/commit/9e7cdfcd9df125b585d874492db89a0ef6e4a034