Fix wrong handling of URI containing space

This commit is contained in:
Christian Dywan 2011-11-15 21:48:59 +01:00
parent 8ecfdd701e
commit 5eda5a3faa
2 changed files with 3 additions and 0 deletions

View file

@ -102,6 +102,7 @@ namespace Midori {
/* file:// is not considered a location for security reasons */ /* file:// is not considered a location for security reasons */
return uri != null return uri != null
&& ((uri.str ("://") != null && uri.chr (-1, ' ') == null) && ((uri.str ("://") != null && uri.chr (-1, ' ') == null)
|| is_http (uri)
|| uri.has_prefix ("about:") || uri.has_prefix ("about:")
|| (uri.has_prefix ("data:") && uri.chr (-1, ';') != null) || (uri.has_prefix ("data:") && uri.chr (-1, ';') != null)
|| (uri.has_prefix ("geo:") && uri.chr (-1, ',') != null) || (uri.has_prefix ("geo:") && uri.chr (-1, ',') != null)

View file

@ -91,6 +91,8 @@ magic_uri_uri (void)
test_input ("example.com", "http://example.com"); test_input ("example.com", "http://example.com");
test_input ("www.google..com", "http://www.google..com"); test_input ("www.google..com", "http://www.google..com");
test_input ("/home/user/midori.html", "file:///home/user/midori.html"); test_input ("/home/user/midori.html", "file:///home/user/midori.html");
test_input ("http://www.google.com/search?q=query test",
"http://www.google.com/search?q=query test");
if (sokoke_resolve_hostname ("localhost")) if (sokoke_resolve_hostname ("localhost"))
{ {
test_input ("localhost", "http://localhost"); test_input ("localhost", "http://localhost");