Bug 1368341 - Fixup handling of file urls in mozharness, r=ahal draft
authorJames Graham <james@hoppipolla.co.uk>
Thu, 25 May 2017 14:08:03 +0100
changeset 585736 54a6e472d98602427c8c91a70cd72832034cdf5a
parent 585735 9d8300d03ee1577499a130cd112b150dc3884c10
child 585737 bc107f4d856846763ca838bc1cba536a84fe5f95
push id61182
push userbmo:james@hoppipolla.co.uk
push dateSun, 28 May 2017 15:40:20 +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: