Summary: | filenames with colons and no path parts are not opened from command line | ||
---|---|---|---|
Product: | [Unmaintained] kpdf | Reporter: | Andreas Bernauer <kde-bugs> |
Component: | general | Assignee: | Albert Astals Cid <aacid> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bluedzins |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Fedora RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Andreas Bernauer
2007-05-29 11:24:37 UTC
SVN commit 669593 by dfaure: Reworked KCmdLineArgs::makeURL to make "kpdf a:b" work when a:b is an existing file in the current directory CCBUGS: 111760, 146105 Albert will backport to 3.x M +14 -13 kernel/kcmdlineargs.cpp M +8 -0 tests/kcmdlineargstest.cpp --- trunk/KDE/kdelibs/kdecore/kernel/kcmdlineargs.cpp #669592:669593 @@ -1331,21 +1331,22 @@ KUrl KCmdLineArgs::makeURL(const char *_urlArg) { - QString urlArg = QFile::decodeName(_urlArg); - if (!QDir::isRelativePath(urlArg)) - { - KUrl result; - result.setPath(urlArg); - return result; // Absolute path. - } + const QString urlArg = QFile::decodeName(_urlArg); + QFileInfo fileInfo(urlArg); + if (!fileInfo.isRelative()) { // i.e. starts with '/', on unix + KUrl result; + result.setPath(urlArg); + return result; // Absolute path. + } - if ( !KUrl::isRelativeUrl(urlArg) ) - return KUrl(urlArg); // Argument is a URL + if ( KUrl::isRelativeUrl(urlArg) || fileInfo.exists() ) { + KUrl result; + result.setPath( cwd()+'/'+urlArg ); + result.cleanPath(); + return result; // Relative path + } - KUrl result; - result.setPath( cwd()+'/'+urlArg ); - result.cleanPath(); - return result; // Relative path + return KUrl(urlArg); // Argument is a URL } void --- trunk/KDE/kdelibs/kdecore/tests/kcmdlineargstest.cpp #669592:669593 @@ -83,6 +83,14 @@ kDebug() << u << endl; assert(u.url() == "http://www.kde.org"); + QFile file("a:b"); + bool ok = file.open(QIODevice::WriteOnly); + assert(ok); + u = KCmdLineArgs::makeURL("a:b"); + qDebug() << u.path(); + assert(u.isLocalFile()); + assert(u.path().endsWith("a:b")); + args->clear(); // Free up memory. SVN commit 669594 by aacid: backport SVN commit 669593 by dfaure: Reworked KCmdLineArgs::makeURL to make "kpdf a:b" work when a:b is an existing file in the current directory BUGS: 111760, 146105 M +10 -9 kcmdlineargs.cpp --- branches/KDE/3.5/kdelibs/kdecore/kcmdlineargs.cpp #669593:669594 @@ -1248,21 +1248,22 @@ KURL KCmdLineArgs::makeURL(const char *_urlArg) { - QString urlArg = QFile::decodeName(_urlArg); - if (!QDir::isRelativePath(urlArg)) - { + const QString urlArg = QFile::decodeName(_urlArg); + QFileInfo fileInfo(urlArg); + if (!fileInfo.isRelative()) { // i.e. starts with '/', on unix KURL result; result.setPath(urlArg); return result; // Absolute path. } - if ( !KURL::isRelativeURL(urlArg) ) - return KURL(urlArg); // Argument is a URL + if ( KURL::isRelativeURL(urlArg) || fileInfo.exists() ) { + KURL result; + result.setPath( cwd()+'/'+urlArg ); + result.cleanPath(); + return result; // Relative path + } - KURL result; - result.setPath( cwd()+"/"+urlArg ); - result.cleanPath(); - return result; // Relative path + return KURL(urlArg); // Argument is a URL } void *** Bug 147808 has been marked as a duplicate of this bug. *** Is this fix was included in KDE 3.5.7? No, it will be in KDE 3.5.8, in case it is released. |