Bug 1368341 - Fixup handling of file urls in mozharness, r=ahal
authorJames Graham <james@hoppipolla.co.uk>
Thu, 25 May 2017 14:08:03 +0100
changeset 586579 0c4c63d70d4290205431d3ac7f23ce7e12749b66
parent 586578 c9d839d793c61078b9c953ad6bee96df8269bde8
child 586580 c6fb400017f150d652c0b2b01f8d619f58c82931
push id61473
push userwcosta@mozilla.com
push dateTue, 30 May 2017 20:31:31 +0000
reviewersahal
bugs1368341
milestone55.0a1
Bug 1368341 - Fixup handling of file urls in mozharness, r=ahal MozReview-Commit-ID: 7BpUFLZttsh
testing/mozharness/mozharness/base/script.py
--- 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: