Commit 30a1f789 authored by Pino Toscano's avatar Pino Toscano

reencode the url from the argument, 'file:/' at the start (for local files)

then, do few checks to better strip the correct "ref" from other '#' in the path
BUG: 195909

svn path=/trunk/KDE/kdegraphics/okular/; revision=992393
parent 3f1010b9
......@@ -57,9 +57,14 @@ Shell::Shell(KCmdLineArgs* args, int argIndex)
so we have to find it manually and build up the URL by taking its ref,
if any.
*/
KUrl url = m_args->url(argIndex);
const QString arg = m_args->arg(argIndex);
const int sharpPos = arg.lastIndexOf(QLatin1Char('#'));
QString arg = m_args->arg(argIndex);
arg.replace(QRegExp("^file:/{1,3}"), "/");
KUrl url = KCmdLineArgs::makeURL(arg.toUtf8());
int sharpPos = -1;
if (!url.isLocalFile() || !QFile::exists(url.toLocalFile()))
{
sharpPos = arg.lastIndexOf(QLatin1Char('#'));
}
if (sharpPos != -1)
{
url = KCmdLineArgs::makeURL(arg.left(sharpPos).toUtf8());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment