Bug 207461 - okular does not handle escaped URL correctly
Summary: okular does not handle escaped URL correctly
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-15 15:19 UTC by Mary Ellen Foster
Modified: 2009-10-13 16:02 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mary Ellen Foster 2009-09-15 15:19:44 UTC
Version:            (using KDE 4.3.1)
OS:                Linux
Installed from:    Fedora RPMs

(I originally reported this issue upstream at https://bugzilla.redhat.com/show_bug.cgi?id=519008 -- as requested, I'm now filing it here.)

If I open a PDF file with spaces in the file name through Firefox, it downloads
successfully, but Okular claims not to be able to open it. This seems to be
because the file has a name like "file with spaces.pdf", but Okular wants to
open "file%20with%20spaces.pdf". Here's a 100% reproduceable test case:
    http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf

[From another comment on the upstream bug]
Looks like the wrong method of KUrl or QUrl is being used (the method which
just throws away the file:// instead of the one which converts to a file name
properly).
Comment 1 Albert Astals Cid 2009-09-15 20:38:55 UTC
from the shell
okular "http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf" <- works
okular "http://homepages.inf.ed.ac.uk/mef/file with spaces.pdf" <- works

What's the problem?
Comment 2 FiNeX 2009-09-15 23:02:41 UTC
Cannot reproduce here (trunk): I've tried to open that file with okular from firefox and konqueror and it always worked. Which version of firefox did you used?

Maybe it could an old firefox version which incorrectly call okular.
Comment 3 Mary Ellen Foster 2009-09-16 14:38:27 UTC
The problem is what happens with downloaded files through Firefox. If I actually try to open that link in Firefox -- not just do "okular http://whatever" -- then, according to ps, the actual command line that's executed is:
    okular file:///tmp/file%20with%20spaces.pdf -caption

The error message that I get in Okular is then "Cannot open file:///tmp/file%2520with%2520spaces.pdf"

In other words, when the file:// URL is sent to Okular in this way, the percent signs get double-escaped and the file can't be opened.
Comment 4 Michal Hlavinka 2009-09-17 07:48:02 UTC
I can confirm this bug in okular 0.9.1. kde 4.3.1

(In reply to comment #1)
> from the shell
> okular "http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf" <- works
> okular "http://homepages.inf.ed.ac.uk/mef/file with spaces.pdf" <- works
> 
> What's the problem?

both of them work for me too

what does not work:

wget "http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf"
okular "file://`pwd`/file%20with%20spaces.pdf"

(kwrite "file://`pwd`/file%20with%20spaces.pdf" works)
Comment 5 Ian Pilcher 2009-10-04 19:09:39 UTC
How is this resolved?  What information are you waiting for?
Comment 6 Albert Astals Cid 2009-10-04 23:09:09 UTC
I've found the problem, just need Pino to be back as it seems he introduced what is causing the problem to fix another problem.
Comment 7 Rex Dieter 2009-10-04 23:24:50 UTC
confirmed, anxiously waiting for pino magic.
Comment 8 Pino Toscano 2009-10-09 00:12:23 UTC
SVN commit 1032944 by pino:

when we remove the file:/ from the argument, do the precent-encoding removal to avoid being percent-encoded more than needed
based on a patch by Albert, slightly changed + unit test by me
BUG: 207461


 M  +5 -0      shell/shell.cpp  
 M  +13 -0     tests/shelltest.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1032944
Comment 9 Pino Toscano 2009-10-09 00:20:13 UTC
SVN commit 1032945 by pino:

when we remove the file:/ from the argument, do the precent-encoding removal to avoid being percent-encoded more than needed
based on a patch by Albert, slightly changed by me
will be in kde 4.3.3
CCBUG: 207461


 M  +5 -0      shell.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1032945