6 Commits

Author SHA1 Message Date
Georges-Antoine Assi
0370b08efc fix(export): fold line breaks in Pegasus metadata values (#5635)
* fix(export): fold line breaks in Pegasus metadata values

ROM names, developers, publishers, genres and other single-line values
were written verbatim, so a line break in one of them started a new
top-level field in metadata.pegasus.txt (for example a per-game launch
command). Fold line breaks into spaces for every single-line field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(export): fold Pegasus asset paths and reject control characters in uploads

Asset references are built from the ROM's file name, which the upload
path accepted with embedded line breaks, so they could still start a new
field in metadata.pegasus.txt. Fold assets.* values like every other
single-line field, and refuse upload file and folder names that carry
control characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:19:34 -05:00
Sam Dornan
1dcda140e2 fix(rom): keep a disc an .m3u lists in place when promoting to a folder (#5076) 2026-10-03 13:37:24 -04:00
Sam Dornan
655976faa9 feat(soundtrack): play SPC, VGM, VGZ and GYM soundtracks in the browser (#5079) 2026-10-03 13:12:28 -04:00
Sam Dornan
94a01965b8 refactor(db): drop stored columns that duplicate derivable data (#4930) 2026-09-30 11:45:18 -04:00
zurdi
e869ecb6b6 Enforce media allowlists and walkthrough provenance in the shared upload path
A folder the scanner maps to a media category now refuses files that
category cannot hold inside resolve_upload_destination, so the chunked
flow the v2 tabs use gets the same allowlist the media routes had, and
those routes drop their own copies. commit_upload records an upload
provenance for walkthrough files that arrive without one and returns the
registered row, which the walkthrough route uses for author and title.
The refresh lock moves to Redis so uploads landing on different gunicorn
workers cannot drop each other rows. An empty body filename is rejected
instead of falling back to the header.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 16:27:38 +02:00
zurdi
f9f68dc0f1 Unify manual file uploads into a ROM across the Files and Media tabs
The Files tab streamed chunks through /roms/upload/* and registered the
result with the scanner listing, while each Media route (soundtracks,
screenshots, manual files, walkthrough files) carried its own copy of the
sanitize, promote, mkdir, stream, stat and DB upsert sequence. Those copies
crashed with FileNotFoundError on a file name outside Latin-1: the browser
sends the header as Latin-1 and the multipart field name as UTF-8, so the
parser target registered under the header name never received the part
and os.stat failed after the folder had been created.

handler/rom_upload.py now owns the shared ingestion (resolve and prepare
the destination, stage next to the target, move into place, refresh the
ROM's file rows through the scanner) and both the chunked completion and a
new receive_rom_file sit on it. The media routes only check the extension
and delegate; a body naming the part differently is a 400. /start gains an
optional body filename that wins over the header, so names outside Latin-1
arrive intact, and rom_id becomes optional in that body.

On the v2 frontend a single useRomFileUpload composable wraps the chunked
upload, the single-file conversion prompt, the toasts and the refetch; the
Files tab, Soundtrack panel, Screenshots subtab, Walkthrough subtab and the
manual "add to ROM folder" target all call it with their folder. The
service sends the real name in the body and a percent-encoded one in the
header. The v2-only uploadScreenshots/uploadWalkthroughFiles service
functions and the soundtrack-only toasts are gone. Media subtabs now
refuse an existing file name (409) like the Files tab, instead of
overwriting it silently.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X1FgnCzXjM3rzkxggi7g6C
2026-09-16 15:29:22 +02:00