Bug 1295948 - fixing method so it works with encoded URLs r=aki
authorTomislav Jurin <svezauzeto12@hotmail.com>
Tue, 29 Nov 2016 20:03:47 +0100
changeset 324780 46a0a73fde9ae76906ac32fe13155457bb457f94
parent 324689 c283c3fbcdcb949c84fbd03e7c53dbfd562f5052
child 324781 b5bb7341ad8a75892822ddf527f45fbeddfdf1e4
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersaki
bugs1295948
milestone53.0a1
Bug 1295948 - fixing method so it works with encoded URLs r=aki MozReview-Commit-ID: I6Fq2Wxmvsw *** Bug 1295948 - fixing method so it works with encoded URLs, changed return method r?aki MozReview-Commit-ID: J9kBeUBDtOh *** return just url MozReview-Commit-ID: 3xB727QAvse
testing/mozharness/mozharness/mozilla/testing/testbase.py
--- a/testing/mozharness/mozharness/mozilla/testing/testbase.py
+++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py
@@ -8,16 +8,17 @@
 import copy
 import os
 import platform
 import pprint
 import re
 import urllib2
 import json
 import socket
+from urlparse import urlparse, ParseResult
 
 from mozharness.base.errors import BaseErrorList
 from mozharness.base.log import FATAL, WARNING
 from mozharness.base.python import (
     ResourceMonitoringMixin,
     VirtualenvMixin,
     virtualenv_config_options,
 )
@@ -156,20 +157,25 @@ class TestingMixin(VirtualenvMixin, Buil
         if self.test_packages_url:
             reference_url = self.test_packages_url
         elif self.installer_url:
             reference_url = self.installer_url
         else:
             self.fatal("Can't figure out build directory urls without an installer_url "
                        "or test_packages_url!")
 
-        last_slash = reference_url.rfind('/')
-        base_url = reference_url[:last_slash]
+        reference_url = urllib2.unquote(reference_url)
+        parts = list(urlparse(reference_url))
 
-        return '%s/%s' % (base_url, file_name)
+        last_slash = parts[2].rfind('/')
+        parts[2] = '/'.join([parts[2][:last_slash], file_name])
+
+        url = ParseResult(*parts).geturl()
+
+        return url
 
     def query_prefixed_build_dir_url(self, suffix):
         """Resolve a file name prefixed with platform and build details to a potential url
         in the build upload directory where that file can be found.
         """
         if self.test_packages_url:
             reference_suffixes = ['.test_packages.json']
             reference_url = self.test_packages_url