Bug 456749

Summary: Cross-platform filename support
Product: [Applications] digikam Reporter: spam-receiver
Component: Database-MysqlAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 7.7.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 8.0.0
Sentry Crash Report:

Description spam-receiver 2022-07-15 10:50:15 UTC
SUMMARY
I use Digikam with MySQL backend, and the photos stored on a WebDAV share.   
Until now, I was solely on Windows, hence I was able to mount the WebDAV share always on the same path.

Now, I additionally want to use a Ubuntu desktop.
The WebDAV share is mounted somewhere (auto-location determined by Ubuntu).
I pointed Digikam on Ubuntu to the same MySQL database and to the WebDAV mount point on Ubuntu, and voila, my photos were there.

Then I realized that this is not true: 
* Digikam thinks the The photos are at ``N:\path\to\photos``
* But on Ubuntu they are at ``/path/to/mountpoint/dav:host=server,ssl=true/path/to/phtotos``

Three topics need to be considered:
1. Photo path in the database should always be relative to the base path.
2. Photo path in the database should be platform-unaware.
3. There should be a way to select a base path which is already in the database, and redirect it to a path in the local installation.


STEPS TO REPRODUCE
1. Photo storage on network location
2. Digikam on Windows with MySQL backend 
3. Digikam on Linux with same MySQL backend
4. Try to manage the same photos (on network location) using the same database

OBSERVED RESULT
Not possible, because base paths to photo storage on network location don't match between Windows and Linux.

EXPECTED RESULT
Same photos and same database should be used on Windows and on Linux.

SOFTWARE/OS VERSIONS
Windows: Win10
macOS: ./.
Linux/KDE Plasma: Ubuntu LTS
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
./.
Comment 1 Maik Qualmann 2022-07-15 10:55:59 UTC

*** This bug has been marked as a duplicate of bug 384820 ***
Comment 2 Maik Qualmann 2022-07-15 11:03:31 UTC
There is currently an undocumented feature. It is possible to add "&/path/to/mount/point" to the network path in the AlbumRoots database table. I plan to make this available in the GUI.

Maik
Comment 3 spam-receiver 2022-07-15 11:13:00 UTC
(In reply to Maik Qualmann from comment #2)
> There is currently an undocumented feature. It is possible to add
> "&/path/to/mount/point" to the network path in the AlbumRoots database
> table. I plan to make this available in the GUI.
> 
> Maik

Can you please explain in detail how the database row should look like after I have added the second base path?
Comment 4 spam-receiver 2022-07-15 11:25:07 UTC
(In reply to spam-receiver from comment #3)
> (In reply to Maik Qualmann from comment #2)
> > There is currently an undocumented feature. It is possible to add
> > "&/path/to/mount/point" to the network path in the AlbumRoots database
> > table. I plan to make this available in the GUI.
> > 
> > Maik
> 
> Can you please explain in detail how the database row should look like after
> I have added the second base path?

I tried (not the question mark in the middle):

networkshareid:?mountpath=N:/path/to/photos?/run/user/1000/gvfs/dav:host=server,ssl=true,user=xyz/path/to/photos

but this broke both, WIndows and Linux... :-(
Comment 5 Maik Qualmann 2022-07-15 11:26:44 UTC
Table: AlbumRoots
Column: identifier

bevor:

networkshareid:?mountpath=N:\path\to\photos

after:

networkshareid:?mountpath=N:\path\to\photos&mountpath=/path/to/another/mountpoint

More paths could be appended, but each path may only exist once under the OS.

Maik
Comment 6 Maik Qualmann 2022-07-15 11:29:09 UTC
Use / instead of \ in my example.

Maik
Comment 7 spam-receiver 2022-07-15 11:52:58 UTC
(In reply to Maik Qualmann from comment #5)
> Table: AlbumRoots
> Column: identifier
> 
> bevor:
> 
> networkshareid:?mountpath=N:\path\to\photos
> 
> after:
> 
> networkshareid:?mountpath=N:\path\to\photos&mountpath=/path/to/another/
> mountpoint
> 
> More paths could be appended, but each path may only exist once under the OS.
> 
> Maik

Sorry, but I can't get this working. I tried with different (existing and non-existing) paths after the second question mark.
Any second path breaks the base path on both, Windows and Linux.
It seems that the feature isn't included in Digikam 7.7.
Comment 8 Maik Qualmann 2022-07-15 14:30:02 UTC
This feature has been around for a long time, your mistake is the second question mark, there is only one question mark.
The second path starts with: &mountpath=

Maik
Comment 9 spam-receiver 2022-07-15 14:46:31 UTC
(In reply to Maik Qualmann from comment #8)
> This feature has been around for a long time, your mistake is the second
> question mark, there is only one question mark.
> The second path starts with: &mountpath=
> 
> Maik

Oh no, stupid me. Can't tell an ampersand from a question mark...
Thank you very much and my apologies.

The undocumented feature works as expected.
This issue can be closed.
Comment 10 Maik Qualmann 2022-07-16 15:16:15 UTC
Git commit 6a630aeab30849225015826aa185cc8a8516cc74 by Maik Qualmann.
Committed on 16/07/2022 at 15:14.
Pushed by mqualmann into branch 'master'.

add support for alternate network paths in the collection view
Related: bug 384820
FIXED-IN: 8.0.0

M  +3    -1    NEWS
M  +4    -0    core/libs/database/collection/collectionlocation.h
M  +6    -3    core/libs/database/collection/collectionmanager.h
M  +5    -3    core/libs/database/collection/collectionmanager_location.cpp
M  +7    -2    core/libs/database/collection/collectionmanager_p.cpp
M  +2    -3    core/libs/database/collection/collectionmanager_p.h
M  +206  -17   core/utilities/setup/collections/setupcollectionview.cpp
M  +21   -8    core/utilities/setup/collections/setupcollectionview.h

https://invent.kde.org/graphics/digikam/commit/6a630aeab30849225015826aa185cc8a8516cc74