test(e2e): drive write-to-file per format in the real UI; fix sidecar perms
Per the owner's testing bar: a Playwright spec registers an admin, seeds one fixture per write-capable type (EPUB, PDF, CBZ, MP3, FLAC, M4A, M4B — generated at runtime, no binary media in git), drives the REAL metadata-editor flow (Edit → change title → in-app dialog → Save & write) for each, and then reads every artifact back INDEPENDENTLY of the app — EPUB/CBZ/sidecar via python zip+XML parse, audio via ffprobe — asserting the written title landed in the FILE and the old one is gone. Writing the e2e exposed a real bug: atomicWrite left server-written sidecars at 0600 root (os.CreateTemp's default), so host-side tools sharing the volume — Calibre reading metadata.opf — were locked out. The temp file is now chmod'd 0644 before the rename, matching the scanner's cover-file convention; the e2e's host-side reads prove it.
This commit is contained in:
1 parent
fb1645c90c
commit
ffbcc53083
2 files changed
+267
No files matched your search
@@ -417,6 +417,14 @@ func atomicWrite(path string, data []byte) error {
|
||||
return err
|
||||
}
|
||||
tmpPath := tmp.Name()
|
||||
// 0644: sidecars/rewritten files must be readable by host-side
|
||||
// tools sharing the volume (Calibre reads metadata.opf); a 0600
|
||||
// temp default would lock everyone but the server out.
|
||||
if err := tmp.Chmod(0o644); err != nil {
|
||||
tmp.Close()
|
||||
os.Remove(tmpPath)
|
||||
return err
|
||||
}
|
||||
if _, err := tmp.Write(data); err != nil {
|
||||
tmp.Close()
|
||||
os.Remove(tmpPath)
|
||||
|
||||
Reference in new issue
Block a user