fix: name the file a variant download is saved as

A .variants/ copy downloads as advision.zip.1c086064, its storage name:
raw.githubusercontent.com sends no Content-Disposition and the download
attribute is ignored across origins. A card whose download name differs
from the file name now says what to save it as, at a glance.
This commit is contained in:
Abdessamad Derraz committed 2026-11-06 08:20:03 +01:00
1 parent 4f930b5573
commit d1535d0787
2 files changed
+31 -1

No files matched your search

+17
View File
@@ -5207,6 +5207,23 @@ class CollectionCardsCarryFullHashes(unittest.TestCase):
self.assertIn(f'<dd class="rb-hash">{value}</dd>', text)
class AVariantCardSaysWhatToSaveItAs(unittest.TestCase):
"""The Download button of a .variants/ card saved advision.zip.1c086064,
the storage name, and nothing said RetroBat looks for advision.zip."""
def test_the_name_to_save_it_under(self):
from scripts.generate_site import FileConsumers, _system_file_card
entry = {"name": "advision.zip", "size": 10, "sha1": "a" * 40,
"path": "bios/Entex/Adventure Vision/.variants/advision.zip.1c086064"}
text = "\n".join(_system_file_card(entry, FileConsumers({}, {})))
self.assertIn("Save as", text)
self.assertIn("advision.zip.1c086064", text)
plain = "\n".join(_system_file_card(
{**entry, "path": "bios/Entex/Adventure Vision/advision.zip"}, FileConsumers({}, {})))
self.assertNotIn("Save as", plain)
class NullReadsAsNone(unittest.TestCase):
"""`upstream: ~` printed `| Upstream | None |` and `bios_filename: null`