----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/120138/#review66454 -----------------------------------------------------------
My attempt at this. Feel free to use it as you see fit. diff --git a/src/urifilters/shorturi/kshorturifilter.cpp b/src/urifilters/shorturi/kshorturifilter.cpp index 00668d9..6c35393 100644 --- a/src/urifilters/shorturi/kshorturifilter.cpp +++ b/src/urifilters/shorturi/kshorturifilter.cpp @@ -130,6 +130,24 @@ bool KShortUriFilter::filterUri( KUriFilterData& data ) const //QUrl url = data.uri(); QString cmd = data.typedString(); + // If a string starts with forward slashes, replace it by one forward slash. + if (cmd.startsWith('/')) { + const int cmdLength = cmd.length(); + for (int i = 0; i < cmdLength; i++) { + if (cmd[i] != '/') { + QString slashes = cmd.left(i).replace(QRegExp("/+"), "/"); + cmd.replace(0, i, slashes); + break; + } + + // The full string contains slashes.. + if (i == cmdLength - 1) { + cmd = "/"; + break; + } + } + } + // Replicate what KUrl(cmd) did in KDE4. This could later be folded into the checks further down... QUrl url(cmd); if (QDir::isAbsolutePath(cmd)) { I'm not sure if this approach is always OK. It works with the current test cases and those two that Arjun added. - Mark Gaiser On sep 11, 2014, 8:50 a.m., Arjun Ak wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://git.reviewboard.kde.org/r/120138/ > ----------------------------------------------------------- > > (Updated sep 11, 2014, 8:50 a.m.) > > > Review request for KDE Frameworks. > > > Repository: kio > > > Description > ------- > > "///..." should produce `QUrl("file:///")` not `QUrl("file://")` > > > Diffs > ----- > > autotests/kurifiltertest.cpp b84dcd0 > src/urifilters/shorturi/kshorturifilter.cpp 00668d9 > > Diff: https://git.reviewboard.kde.org/r/120138/diff/ > > > Testing > ------- > > > Thanks, > > Arjun Ak > >
_______________________________________________ Kde-frameworks-devel mailing list Kde-frameworks-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-frameworks-devel