Bug 1405408 - Pre: Handle query string and fragments in URL parameters. r=dustin

This was simply oversight before.  I ran into this using the
taskcluster-proxy /bewit interface, which returns a URL of the form
https://domain.net/short/path/to.file?bewit="several thousand
characters", which leads to an IOError due to the long path.  Let's
assume that such query strings and fragments are transient; we should
drop these parts of the fetched URLs when writing to disk.

MozReview-Commit-ID: FMJHMp7a3rA

--HG--
extra : rebase_source : da701e7d5250f59f39e4b6262952a08d0068e9ac
This commit is contained in:
Nick Alexander 2017-10-05 13:30:21 -07:00
Родитель 3e72eff02a
Коммит abeea7e96e
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -790,7 +790,9 @@ class ArtifactCache(object):
# human readable unique name, but extracting build IDs is time consuming
# (especially on Mac OS X, where we must mount a large DMG file).
hash = hashlib.sha256(url).hexdigest()[:16]
fname = hash + '-' + os.path.basename(url)
# Strip query string and fragments.
basename = os.path.basename(urlparse.urlparse(url).path)
fname = hash + '-' + basename
path = os.path.abspath(mozpath.join(self._cache_dir, fname))
if self._skip_cache and os.path.exists(path):