diff --git a/scripts/generate_site.py b/scripts/generate_site.py index 044a1685..8c376854 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -2380,7 +2380,7 @@ def _served_line(f: dict) -> str: if f.get("status") == "missing": return "Not held" if not path: - # verify reports no path in existence mode: nothing to name. + # A slot the pack fills from a release asset or leaves to the user. return "" sha1 = _collection_sha1_by_path().get(path, "") label = "Served by" if f.get("status") == "ok" else "Held, not the declared hash" diff --git a/scripts/verify.py b/scripts/verify.py index 8e509567..3c6fe172 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -189,12 +189,13 @@ def verify_entry_existence( resolve_status: str = "", platform_display: str = "", ) -> dict: - """RetroArch verification: path_is_valid(), a file that exists is OK.""" + """RetroArch verification: path_is_valid(), a file that exists is OK. + The result names the collection file found, as the hash modes do.""" name = file_entry.get("name", "") required = file_entry.get("required", True) if not local_path: return {"name": name, "status": Status.MISSING, "required": required} - result = {"name": name, "status": Status.OK, "required": required} + result = {"name": name, "status": Status.OK, "required": required, "path": local_path} if resolve_status == "hash_mismatch": # The frontend reads no bytes, so the file stays, and the declared hash # it contradicts is reported, as the pack does. diff --git a/tests/test_verify_listing.py b/tests/test_verify_listing.py index e58b0292..82b25229 100644 --- a/tests/test_verify_listing.py +++ b/tests/test_verify_listing.py @@ -152,6 +152,16 @@ class ExistenceReportsWhatThePackReports(unittest.TestCase): self.assertEqual(result["status"], verify.Status.OK) self.assertIn("declared hash 9d2ff233", result["discrepancy"]) + def test_the_file_found_is_named(self): + """RetroArch, Lakka and RetroPie pages showed no "Served by" line: + existence mode returned no path, where the hash modes return one.""" + sys.path.insert(0, str(REPO_ROOT / "scripts")) + import verify # noqa: PLC0415 + + found = verify.verify_entry_existence({"name": "a.bin"}, "bios/X/Y/a.bin") + self.assertEqual(found["path"], "bios/X/Y/a.bin") + self.assertNotIn("path", verify.verify_entry_existence({"name": "a.bin"}, None)) + class TheDestinationsFlagNeedsAPack(unittest.TestCase): """--destinations describes a platform's full pack: another mode refuses it."""