mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-28 04:18:52 -06:00
fix: accept each listed hash of a download
download_external compared the digest with the field as a string, so a list or a comma-joined field never matched. It reads the strongest declared field with declared_hash_lists and accepts any of its values. The release asset lookup reads the same helper instead of its own copy.
This commit is contained in:
1 parent
02969dda06
commit
526d7f09c7
2 files changed
+32
-31
No files matched your search
@@ -7623,6 +7623,19 @@ class ExternalDownloadsFollowTheRunPolicy(unittest.TestCase):
|
||||
self.assertFalse(packresolve.download_external(self.ENTRY, str(target), offline=False))
|
||||
self.assertFalse(target.exists())
|
||||
|
||||
def test_every_accepted_value_of_a_listed_field_verifies(self):
|
||||
# A list or a comma-joined field was compared as its string form
|
||||
# ("['a', 'b']"), so no body could ever match it.
|
||||
from resolve import packfiles as packresolve
|
||||
|
||||
good = hashlib.sha1(b"payload").hexdigest().upper()
|
||||
for sha1 in (["0" * 40, good], f"{'0' * 40}, {good}"):
|
||||
with self.subTest(sha1=sha1), tempfile.TemporaryDirectory() as tmp, \
|
||||
mock.patch.object(packresolve.urllib.request, "urlopen",
|
||||
return_value=self._response(b"payload")):
|
||||
entry = {**self.ENTRY, "sha1": sha1}
|
||||
self.assertTrue(packresolve.download_external(entry, f"{tmp}/x", offline=False))
|
||||
|
||||
def test_scratch_files_stay_in_the_repository(self):
|
||||
source = script_source("generate_pack.py")
|
||||
self.assertNotIn("def download_external", source)
|
||||
|
||||
Reference in new issue
Block a user