Bug 63153 - Unnecessary filtering file:// for pcmanfm
Summary: Unnecessary filtering file:// for pcmanfm
Status: RESOLVED FIXED
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: 1.1.0 rc1
Hardware: Other Linux (All)
: medium normal
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2013-04-05 09:52 UTC by Vladimir
Modified: 2014-09-19 18:08 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Fix for #63153 by passing the whole URL to pcmanfm (859 bytes, patch)
2014-06-24 20:18 UTC, David Costa
Details | Splinter Review
Fix for #63153 by urldecoding (963 bytes, patch)
2014-06-24 20:20 UTC, David Costa
Details | Splinter Review
Followup of 0001-xdg-open-fixes-63153-keeping-the-path-as-URL.patch (751 bytes, patch)
2014-06-24 23:19 UTC, David Costa
Details | Splinter Review

Description Vladimir 2013-04-05 09:52:37 UTC
In LXDE if xdg-open is invoked with encoded file:// URL, PCManFM reports "no such file".

It happens because xdg-open filters out 'file://' prefix on line 672:
       local file="$(echo "$1" | sed 's%^file://%%')"
PCManFM recieves encoded URL without prefix, so it tries to open gibberish path without interpreting URL encoding.

Example:
xdg-open file:///tmp/media/%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%B0/
pcmanfm should recieve either 'file:///tmp/media/%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%B0/' or '/tmp/media/работа/'
But it recieves '/tmp/media/%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%B0/' which is gibberish.

'file://' prefix should be passed through to PCManFM
Comment 1 Rex Dieter 2013-04-05 10:15:46 UTC
I'm pretty sure
file://
isn't a valid URL
Comment 2 Rex Dieter 2013-04-05 10:16:48 UTC
ah, nevermind.  I see the point you're making, and I think I agree.
Comment 3 David Costa 2014-06-24 20:18:26 UTC
Created attachment 101692 [details] [review]
Fix for #63153 by passing the whole URL to pcmanfm

The strategy of this patch is to avoid stripping file:// from the URL.

The patch is based off the git version of xdg-utils, commit 869b22b7.
I tested it on ArchLinux with some applications like clementine and calibre.
Comment 4 David Costa 2014-06-24 20:20:53 UTC
Created attachment 101693 [details] [review]
Fix for #63153 by urldecoding

Alternative patch: this takes the code already used in open_generic() to strip the file:// off the URL and then urldecode the rest of the string.

The patch is based off the git version of xdg-utils, commit 869b22b7.
I tested it on ArchLinux with some applications like clementine and calibre.
Comment 5 David Costa 2014-06-24 23:19:40 UTC
Created attachment 101704 [details] [review]
Followup of 0001-xdg-open-fixes-63153-keeping-the-path-as-URL.patch

With the previous patch file:// URLs with relative paths are expanded in the wrong way. This patch fixes it and must be applied after 0001-xdg-open-fixes-63153-keeping-the-path-as-URL.patch

File URLs are described in RFC 1738, section 3.10 but it's not clear if relative paths are possible or not. xdg-open assumes it is possible so the new patch appends the current working directory between file:// and the rest in order to make it an absolute path. That's just the same old behavior applied to a file:// URL
Comment 6 Rex Dieter 2014-09-19 18:08:43 UTC
I opted for the simpler initial version you supplied, thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.