After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 630266 - g_file_new_for_uri() doesn't like percent-encoded slashes in URLs
g_file_new_for_uri() doesn't like percent-encoded slashes in URLs
Status: RESOLVED DUPLICATE of bug 581032
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-09-21 14:08 UTC by Will Thompson
Modified: 2010-09-21 16:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GFile: accept URIs containing percent-encoded / in path (3.26 KB, patch)
2010-09-21 16:09 UTC, Will Thompson
none Details | Review

Description Will Thompson 2010-09-21 14:08:43 UTC
An Empathy user reported that clicking certain links just yielded a dialog saying ‘error opening location: Operation not supported’, but not all. A bit of guesswork revealed that all the non-functional URLs contained %2F, which is the percent-encoding for a forward-slash.

This is a pretty sketchy thing to find in a URL, but such URLs exist in the wild. The problem seems to be caused by:

  decoded->path = unescape_string (hier_part_start, hier_part_end, "/");

in _g_decode_uri: / is explicitly declared to be illegal, and so _g_decode_uri() returns NULL, so gvfs-open ultimately fails, etc. etc. leading to the user being shown a totally meaningless error message.

Not really sure what the best solution would be here, besides just allowing escaped slashes in URLs. I don't really see that it would hurt anyone.
Comment 1 Will Thompson 2010-09-21 16:08:19 UTC
Philip Withnall did some research, and it turns out that percent-encoded slashes are perfectly legal! Gustavo Noronha did some more research, and can't find anything forbidding them in relevant RFCs, and notes that SoupURI doesn't have this check.

So here's a branch that just removes the check: http://git.collabora.co.uk/?p=user/wjt/glib;a=commitdiff;h=refs/heads/laxer-uri-parsing.
Comment 2 Will Thompson 2010-09-21 16:09:20 UTC
Created attachment 170763 [details] [review]
GFile: accept URIs containing percent-encoded / in path

And here's the patch if folks want to review it here.
Comment 3 Dan Winship 2010-09-21 16:29:37 UTC
The problem is that GFile doesn't deal with "real" URIs, it deals with gvfs URIs, which have different (and incompatible) encoding/decoding rules. Yes, this is a mess.

*** This bug has been marked as a duplicate of bug 581032 ***