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 670755 - g_filename_from_uri() mishandles query component
g_filename_from_uri() mishandles query component
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-02-24 16:50 UTC by Dan Winship
Modified: 2018-05-24 13:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dan Winship 2012-02-24 16:50:46 UTC
g_filename_from_uri("file:///tmp/foo.html?a=1") =>
  "/tmp/foo.html?a=1"

which is definitely wrong; it should either strip off the query, or else treat it as an error, like it does with fragments.

From an ABI-breakage POV, it would be difficult (but not impossible) for anyway to be using the current behavior in a useful way. In particular, queries do not round-trip correctly:

  g_filename_to_uri(g_filename_from_uri("file:///tmp/foo.html?a=1")) =>
  "file:///tmp/foo.html%3Fa=1"

Though someone might be expecting that they can call g_filename_from_uri() and then parse out the query afterward (which is broken since it will do the wrong thing with filenames that actually contain "?"s). Or, someone might be mistakenly failing to escape a "?" that actually appears in a path, and relying on the bug to make that work. Both of these seem unlikely though.


It seems to me like the function ought to strip both query and fragment, without considering either to be an error. It also seems unlikely that someone would be intentionally depending on the function to return an error if the passed-in URI contains a fragment. But not so unlikely that I'd want to change the behavior this close to a release...


Opinions?
Comment 1 GNOME Infrastructure Team 2018-05-24 13:48:09 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/519.