From 83fdc97edd79d004ee2ccf15e0c7fb9a0060a1c6 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sat, 21 Nov 2026 00:32:40 +0100 Subject: [PATCH] fix: skip quoted hashes in batocera item notes --- scripts/exporter/batocera_exporter.py | 3 ++- tests/test_exporters.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/exporter/batocera_exporter.py b/scripts/exporter/batocera_exporter.py index d361cd4f9..20410fb5b 100644 --- a/scripts/exporter/batocera_exporter.py +++ b/scripts/exporter/batocera_exporter.py @@ -422,7 +422,8 @@ class Exporter(BaseExporter[str]): pending: list[str] = [] for line in lines: stripped = line.strip() - hash_at = line.find("#") + cut = comment_start(line) + hash_at = -1 if cut is None else cut if stripped.startswith("#"): pending.append(stripped) continue diff --git a/tests/test_exporters.py b/tests/test_exporters.py index 09bf1a69b..ed2ce4def 100644 --- a/tests/test_exporters.py +++ b/tests/test_exporters.py @@ -3017,6 +3017,12 @@ class BatoceraNotesStayWithTheirItem(unittest.TestCase): self.assertEqual(leading, {("bios/bk0010.zip", "one.rom"): ["# head note", "# MAME"]}) self.assertEqual(trailing, {("bios/bk0010.zip", "two.rom"): "# tail"}) + def test_hash_inside_a_quoted_path_is_no_note(self): + from exporter.batocera_exporter import Exporter + + lines = [' { "md5": "", "file": "ports/opentyrian/newsh#.shp" },'] + self.assertEqual(Exporter._item_notes(lines), ({}, {})) + class TheWikiNamesWhatCountsAnExport(unittest.TestCase): """adding-a-platform listed the methods that say what a format can hold