Fix remote checksums when paths have leading dots (#45287)

* Fix remote checksums with paths have leading dots

* Fix result recorded from the wrong file

* Add changelog fragment
This commit is contained in:
David Rodríguez 2018-09-11 13:47:29 -03:00 committed by Sam Doran
parent 5d6f844eba
commit 600c7ac108
3 changed files with 29 additions and 1 deletions

View file

@ -465,7 +465,7 @@ def main():
os.remove(checksum_tmpsrc)
lines = dict(s.split(None, 1) for s in lines)
filename = url_filename(url)
[checksum] = (k for (k, v) in lines.items() if v == filename)
[checksum] = (k for (k, v) in lines.items() if v.strip('./') == filename)
# Remove any non-alphanumeric characters, including the infamous
# Unicode zero-width space
checksum = re.sub(r'\W+', '', checksum).lower()