Fixes error in UrlUtils validating urls with file scheme

Change-Id: I3590fb2d712bfb71a8c8918be4c73af317bacd00
Closes-Bug: 1599744
This commit is contained in:
Miguel Caballer 2016-07-07 09:32:31 +02:00
parent 54c1b00149
commit 900d4135c0
2 changed files with 6 additions and 1 deletions

View File

@ -29,6 +29,7 @@ class UrlUtilsTest(TestCase):
self.assertFalse(self.url_utils.validate_url("github.com"))
self.assertFalse(self.url_utils.validate_url("123"))
self.assertFalse(self.url_utils.validate_url("a/b/c"))
self.assertTrue(self.url_utils.validate_url("file:///dir/file.ext"))
def test_urlutils_join_url(self):
self.assertEqual(

View File

@ -35,7 +35,11 @@ class UrlUtils(object):
URL.
"""
parsed = urlparse(path)
return bool(parsed.scheme) and bool(parsed.netloc)
if parsed.scheme == 'file':
# If the url uses the file scheme netloc will be ""
return True
else:
return bool(parsed.scheme) and bool(parsed.netloc)
@staticmethod
def join_url(url, relative_path):