Bug 1368341 - Fixup handling of file urls in mozharness, r=ahal
MozReview-Commit-ID: 7BpUFLZttsh
--- a/testing/mozharness/mozharness/base/script.py
+++ b/testing/mozharness/mozharness/base/script.py
@@ -364,20 +364,21 @@ class ScriptMixin(PlatformMixin):
Returns:
BytesIO: contents of url
'''
self.info('Fetch {} into memory'.format(url))
parsed_url = urlparse.urlparse(url)
if parsed_url.scheme in ('', 'file'):
- if not os.path.isfile(url):
+ path = parsed_url.path
+ if not os.path.isfile(path):
raise IOError('Could not find file to extract: {}'.format(url))
- content_length = os.stat(url.replace('file://', '')).st_size
+ content_length = os.stat(path).st_size
# In case we're referrencing a file without file://
if parsed_url.scheme == '':
url = 'file://%s' % os.path.abspath(url)
parsed_url = urlparse.urlparse(url)
request = urllib2.Request(url)
# When calling fetch_url_into_memory() you should retry when we raise one of these exceptions: