Bug 418647 - kphotoalbum --db always uses 'index.xml' even if a different filename is specified
Summary: kphotoalbum --db always uses 'index.xml' even if a different filename is spec...
Status: RESOLVED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: Backend (show other bugs)
Version: GIT master
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-08 22:13 UTC by rlk
Modified: 2024-12-09 21:51 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rlk 2020-03-08 22:13:57 UTC
SUMMARY

kphotoalbum always uses index.xml as the file part of the path, even if --db specifies otherwise, e. g.

kphotoalbum --db index2.xml

STEPS TO REPRODUCE
1. Create (or not) a database file named something other than index.xml
2. run kphotoalbum --db something_not_named_index.xml

OBSERVED RESULT

kphotoalbum loads index.xml if present, or prompts to create one if not, regardless of whether the specified file name exists.

EXPECTED RESULT

kphotoalbum should use the specified filename.

SOFTWARE/OS VERSIONS
All irrelevant; the issue is in kphotoalbum proper.  This happens to be with revision c4a5190fc63879f4d3051550cbe30d0604dc5b68
Comment 1 Johannes Zarl-Zierl 2024-08-03 15:50:46 UTC
Thanks to the work by rsquared on https://invent.kde.org/graphics/kphotoalbum/-/merge_requests/33, this bug is now resolved: KPhotoAlbum now rejects file names other than index.xml instead of silently changing the file name to index.xml.

I do accept follow-up bug reports to actually allow different file names, but fixing that is significantly more work because 'index.xml' is hard-coded at various places in the code-base.
Comment 2 Johannes Zarl-Zierl 2024-08-03 15:50:53 UTC
Git commit a35ae72934d6fd370486e65492a652ad62b6c9ce by Johannes Zarl-Zierl.
Committed on 03/08/2024 at 15:45.
Pushed by johanneszarl into branch 'master'.

Update Changelog

Add change log entry for the following change:
fa8150d1 Don't allow non-existant directories with --db
2499bcbf Be more restricting in allowed filenames.
4940a38a Remove unintended change.
ba245601 Move and refactor per review comments.
cadf882a Bail with an error message on invalid input.

Kudos to rsquared for doing most of the work on this!

M  +1    -0    CHANGELOG.md

https://invent.kde.org/graphics/kphotoalbum/-/commit/a35ae72934d6fd370486e65492a652ad62b6c9ce
Comment 3 Johannes Zarl-Zierl 2024-09-13 21:30:04 UTC
Git commit 562c4dfeda0528c32ede7764c82067698a9f7d2e by Johannes Zarl-Zierl.
Committed on 13/09/2024 at 21:28.
Pushed by johanneszarl into branch 'kf6'.

Update Changelog

Add change log entry for the following change:
e32f2038 Don't allow non-existant directories with --db
b7367c78 Be more restricting in allowed filenames.
a38583d7 Remove unintended change.
b66ed4d4 Move and refactor per review comments.
0281fcc2 Bail with an error message on invalid input.
76590ed9 Handle directory passed on the command line.

Kudos to rsquared for doing most of the work on this!

Note: this is a port of the existing bugfix on the KF5/Qt5 branch
(master) to the kf6 branch.

M  +1    -0    CHANGELOG.md

https://invent.kde.org/graphics/kphotoalbum/-/commit/562c4dfeda0528c32ede7764c82067698a9f7d2e
Comment 4 Johannes Zarl-Zierl 2024-12-09 21:51:00 UTC
Git commit f597db3ac651034aa1ba55abd51dd229bb3d4e96 by Johannes Zarl-Zierl, on behalf of Randall Rude.
Committed on 09/12/2024 at 21:43.
Pushed by johanneszarl into branch 'master'.

Allow database file names other than index.xml

This patch mostly eliminates hard-coded occurrences of index.xml (addressing the
now-closed bug 418647).

Exceptions:

Import/export and the demo are unchanged (ie. still use/require index.xml).
The default filename is still index.xml if the user specifies a directory on the
command line.

User-visible changes in this patch:

KPhotoAlbum no longer requires the database file to be named index.xml.
The database base filename is reported on the main window titlebar.
The auto-save and numbered backup filenames are derived from the database
filename.
Various comments and log messages that refer to index.xml are generalized.

Squashed commit of the following:

commit 7bd7f6e3f387ac1dc79be425a52b8b2dfab4895a
Author: Randall Rude <rsquared42@proton.me>
Date:   Thu Dec 5 17:43:27 2024 -0700

    Improve message.

commit b3ae1e49ef2b7f097119e9c8b98ac98d844f203d
Author: Randall Rude <rsquared42@proton.me>
Date:   Thu Dec 5 17:36:57 2024 -0700

    Fix comment.

commit f7997454348369fd523539c59ee3c22931e0ec8d
Author: Randall Rude <rsquared42@proton.me>
Date:   Wed Aug 21 17:55:26 2024 -0600

    Derive numbered backup filename from db filename.

commit 4f2b0688214e09c419b42f1b8322149ca921c22d
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Aug 4 12:19:03 2024 -0600

    Create any db filename.

commit 0d9ea9326761cd21243fbc3226e932f4d3b52e58
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Aug 4 11:44:21 2024 -0600

    Derive autosave filename from db filename.

commit b27f5e359942e1b43e3791d6a8d752f4a1518fb1
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Aug 4 11:34:04 2024 -0600

    Accept any db filename.

commit a7871487f9397f3b1d38f92fee45230b97fca3f6
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Jul 28 09:09:32 2024 -0600

    Remove unintended change.

commit 30f0bbc254bed9b8af371277f819509f10542595
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Jul 28 09:06:16 2024 -0600

    Move and refactor per review comments.

commit 2e088503f17b3cb3b538172992395bc8d26bc6d5
Author: Randall Rude <rsquared42@proton.me>
Date:   Tue Mar 5 13:40:35 2024 -0700

    Bail with an error message on invalid input.

commit b54d3bf8c134d3a37bd02c622678e74b8459b258
Author: Randall Rude <rsquared42@proton.me>
Date:   Wed Feb 21 11:25:38 2024 -0700

    Handle directory passed on the command line.

commit 3a96c08d50bd6fbaf044d090970813df9518a9b3
Author: Randall Rude <rsquared42@proton.me>
Date:   Thu Nov 21 09:35:25 2024 -0700

    Generalize messages.

commit eb1e3108b146a0c92595bed751f08a8b9f86f1b3
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Jul 28 09:09:32 2024 -0600

    Remove unintended change.

commit a68e4d4c47aa90a7318db12d6beae50e5d038462
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Jul 28 09:06:16 2024 -0600

    Move and refactor per review comments.

commit a23040db230bef085b23064491f9e6add1fdfbc7
Author: Randall Rude <rsquared42@proton.me>
Date:   Thu Dec 5 17:36:57 2024 -0700

    Fix comment.

commit 65087f2445eacc56b1f7894879a53ad4e5db2bb8
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Aug 4 11:34:04 2024 -0600

    Rebase on current master.

commit b07096c1858f74d0aea59c53b7cc66288d1403ac
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Jul 28 09:06:16 2024 -0600

    Rebase against current master.

commit 3821047e681bfce4457ca5790cdb63f6df9fac03
Author: Randall Rude <rsquared42@proton.me>
Date:   Tue Mar 5 13:40:35 2024 -0700

    Bail with an error message on invalid input.

commit 437eff7b617266a06fd2cf0b106385ddb63b460b
Author: Randall Rude <rsquared42@proton.me>
Date:   Wed Feb 21 11:25:38 2024 -0700

    Handle directory passed on the command line.

commit fd93c903b91f57fdb4bfb2777c39b54ce8f821cf
Author: Randall Rude <rsquared42@proton.me>
Date:   Thu Nov 21 09:35:25 2024 -0700

    Generalize messages.

commit d70c2011891cd64d2afa21efcdbd26d55bcb2d34
Author: Randall Rude <rsquared42@proton.me>
Date:   Wed Aug 21 17:55:26 2024 -0600

    Derive numbered backup filename from db filename.

commit 047838db81c11c34afc5ea981be383513d0cea7c
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Aug 4 11:44:21 2024 -0600

    Derive autosave filename from db filename.

commit 47d8932acc429d287a51fcda8fe9e84017ab3655
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Jul 28 09:09:32 2024 -0600

    Remove unintended change.

commit bf56b2b37e75e838c81ee15821fd7f3283b99523
Author: Randall Rude <rsquared42@proton.me>
Date:   Sun Jul 28 09:06:16 2024 -0600

    Move and refactor per review comments.

M  +2    -2    DB/Category.h
M  +24   -4    DB/ImageDB.cpp
M  +22   -1    DB/ImageDB.h
M  +8    -8    DB/XML/FileReader.cpp
M  +9    -9    DB/XML/FileWriter.cpp
M  +20   -19   DB/XML/NumberedBackup.cpp
M  +55   -1    DB/XML/NumberedBackup.h
M  +23   -34   MainWindow/Window.cpp
M  +8    -7    Settings/DatabaseBackendPage.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/f597db3ac651034aa1ba55abd51dd229bb3d4e96