| Summary: | QUrl::path() returns invalid pathes on Windows | ||
|---|---|---|---|
| Product: | [Applications] umbrello | Reporter: | Ralf Habacker <ralf.habacker> |
| Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | simonandric5 |
| Priority: | NOR | ||
| Version First Reported In: | frameworks5 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Microsoft Windows | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Bug Depends on: | |||
| Bug Blocks: | 373932 | ||
umbrello source code does not use QUrl::path() anymore. |
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.