GNOME Bugzilla – Bug 670755
g_filename_from_uri() mishandles query component
Last modified: 2018-05-24 13:48:09 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?
-- 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.