[umbrello] [Bug 382239] New: QUrl::path() returns invalid pathes on Windows

Ralf Habacker bugzilla_noreply at kde.org
Tue Jul 11 13:55:43 UTC 2017


https://bugs.kde.org/show_bug.cgi?id=382239

            Bug ID: 382239
           Summary: QUrl::path() returns invalid pathes on Windows
           Product: umbrello
           Version: frameworks5
          Platform: Other
                OS: MS Windows
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: umbrello-devel at kde.org
          Reporter: ralf.habacker at freenet.de
            Blocks: 373932
  Target Milestone: ---

On porting KUrl::path() references directly to QUrl::path() the related
locations returns invalid file pathes on Windows as shown with following
examples:

    QUrl b = QUrl::fromLocalFile("/test/test.xyz");
    qDebug() << b.path() << b.toLocalFile();
    b = QUrl::fromLocalFile("c:/test/test.xyz");
    qDebug() << b.path() << b.toLocalFile();
    b = QUrl::fromLocalFile("c:\\test\\test.xyz");
    qDebug() << b.path() << b.toLocalFile();

Running this code on Windows returns 

"/test/test.xyz" "/test/test.xyz"
"/c:/test/test.xyz" "c:/test/test.xyz"
"/c:/test/test.xyz" "c:/test/test.xyz"

line 2 and 3  column 1 shows that QUrl::path() always prefixes the path with
'/' which is incorrect.

KUrl from KDE4 does not have this problem because it covers the "local file
case" (see
https://github.com/KDE/kdelibs/blob/KDE/4.14/kdecore/io/kurl.cpp#L873 for
details).

Instead QUrl::toLocalFile() should be used, which is also safe to use on non
Windows OS.


Referenced Bugs:

https://bugs.kde.org/show_bug.cgi?id=373932
[Bug 373932] Fix KF5 issues
-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the umbrello-devel mailing list