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 317456 - GURI is unable to parse file:/// URIs
GURI is unable to parse file:/// URIs
Status: RESOLVED FIXED
Product: gnet
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: David Helder
David Helder
Depends on:
Blocks:
 
 
Reported: 2005-09-28 18:12 UTC by Milosz Derezynski
Modified: 2006-09-11 09:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix for this bug. (528 bytes, patch)
2005-09-28 18:13 UTC, Milosz Derezynski
committed Details | Review

Description Milosz Derezynski 2005-09-28 18:12:07 UTC
Please describe the problem:
GURI is not able to parse file:/// style URIs. Upon giving gnet_uri_new() a
file:/// URI, NULL is being returned.

Steps to reproduce:
1. Run: GURI *guri = gnet_uri_new("file:///foo/bar/wee/yahoo.file"); (or any
other file:/// URI)
2. guri is NULL

Actual results:
The return value is NULL

Expected results:
A valid GURI with the initial URI string properly parsed into the GURI struct.

Does this happen every time?
Yes.

Other information:
No other information :P
Comment 1 Milosz Derezynski 2005-09-28 18:13:03 UTC
Created attachment 52782 [details] [review]
Proposed fix for this bug.

This patch effectively fixes the bug.
Comment 2 Tim-Philipp Müller 2005-10-02 13:47:47 UTC
There are some things I'm wondering about, like whether the file://
protocol/schema be special-cased in certain ways?

For example:

1) Do we only want to allow absolute paths?
If yes, we need to special-case and check for the third slash. If no, we should
either return an error or prepend the current working directory to the path.
With the current patch, we'd silently split up relative paths into hostname and
path rest, which doesn't sound quite right.

2) What to do with fragment/etc.?
Should we special-case file:// URIs and thus allow '#' and '?' characters in the
path (especially the '?' might be common in song titles)? Or should we just
process them as usual and split them off?

I'm leaning towards special-casing file:// URIs for both 1) and 2)
What do you think?

Cheers
 -Tim
Comment 3 Tim-Philipp Müller 2006-09-11 09:24:31 UTC
Should be fixed in CVS:

 2006-09-11  Tim-Philipp Müller  <tim at centricular dot net>

       * src/uri.c: (gnet_uri_new), (gnet_uri_get_string):
       * tests/uri_test.c: (main):
         Add support for absolute file:// URIs and add two simple test cases.
         Not entirely convinced about the required fix to _get_string(), but
         it doesn't seem to break any of the tests, so it can't be too bad
         even if it's not entirely correct. Fixes bug #317456. Based
         on patch by Milosz Derezynski <internalerror at gmail com>


(Only handles absolute file URIs as it should. Escaping etc. works just like with all other URIs, so no special casing).