Bug 391744 - Can't import network share with non-ascii character in path
Summary: Can't import network share with non-ascii character in path
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Setup-Database (show other bugs)
Version: 5.8.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-12 07:00 UTC by wojciech.binek
Modified: 2018-03-13 19:44 UTC (History)
2 users (show)

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


Attachments
Collections window with path with non-ascii character. (50.68 KB, image/png)
2018-03-12 08:40 UTC, wojciech.binek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wojciech.binek 2018-03-12 07:00:17 UTC
I try to set digikam with external MySQL database to search for files on SMB share. When I try to add a collection on network share with non-ascii character I get following error in console:

[3876] digikam.general: No DB settings changes. Do nothing...
[3876] digikam.database: addLocation  QUrl("file:///Z:/Zdjecia/_Wakacje - wspólne")
[3876] digikam.database: Creating new Location  "/"  uuid  "networkshareid:?mountpath=Z:/Zdjecia/_Wakacje - wspólne"
[3876] digikam.database: location for  "Z:/Zdjecia/_Wakacje - wsp?lne"  is available  false

When I add the same path as local storage it is added properly. I checked the db entery and the path is ok there. I also tested other db backends and the problem appeared on all of them.

Steps to reproduce:
 1) Add network collection path with non-ascii character
Actual Results: Error, collection not added
Expected Results: New collection added
Build: Jan 10 2018 digiKam 5.8.0
Comment 1 caulier.gilles 2018-03-12 08:25:07 UTC
What's the expected no ascii cararacters used in your path to reproduce the problem ?

Gilles Caulier
Comment 2 wojciech.binek 2018-03-12 08:31:24 UTC
I had problems with polish characters 'ó' and 'ę', but I think that others will be problematic too. I also noticed that when the characters are not in the base of the path the subpath is added correctly: 

1. When I add "Z:/Zdjecia/_Wakacje - wspólne" - error
2. When I add "Z:/Zdjecia/" - no error and automatically adds subpath "_Wakacje - wspólne"
3. When I add "Z:/Zdjęcia/" (ę instead of e) - error
Comment 3 wojciech.binek 2018-03-12 08:40:52 UTC
Created attachment 111335 [details]
Collections window with path with non-ascii character.

The same path is set for local and network collection. For local it is ok, for network there is an error.
Comment 4 Maik Qualmann 2018-03-12 12:10:10 UTC
The cause is here. Why too toLocal8Bit()? I fix it tonight.

QStringList CollectionManagerPrivate::networkShareMountPathsFromIdentifier(const AlbumRootLocation* location)
{
    // using a QUrl because QUrl cannot handle duplicate query items
    QUrl url = QUrl::fromEncoded(location->identifier.toLocal8Bit());

    if (url.scheme() != QLatin1String("networkshareid"))
    {
        return QStringList();
    }

    return QUrlQuery(url).allQueryItemValues(QLatin1String("mountpath"));
}

Maik
Comment 5 Maik Qualmann 2018-03-12 20:06:34 UTC
Git commit 8490cd2b9c459b549753563274d8a7d630567395 by Maik Qualmann.
Committed on 12/03/2018 at 20:05.
Pushed by mqualmann into branch 'master'.

fix access to non-ascii character in the network share path
Related: bug 380220
FIXED-IN: 5.9.0

M  +3    -1    NEWS
M  +1    -1    libs/database/collection/collectionmanager.cpp

https://commits.kde.org/digikam/8490cd2b9c459b549753563274d8a7d630567395
Comment 6 caulier.gilles 2018-03-13 10:11:46 UTC
The 5.9.0 pre-release installer is updated with last fix from Maik. Please try
and report :

https://files.kde.org/digikam/
Comment 7 wojciech.binek 2018-03-13 19:44:56 UTC
I tested the new version on couple of folders and it seems ok now. 
Thanks!