fix(backend): single error body on pages paths, reject newline entry names, empty-index cache skip

This commit is contained in:
2026-09-05 20:56:05 +08:00
parent 0946f6be5a
commit 8206c7a4ed
3 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ func TestPageIndexSortAndFilter(t *testing.T) {
}
func TestPageIndexRejectsSlip(t *testing.T) {
for _, bad := range []string{"../evil.jpg", "/etc/passwd.jpg", "a\\..\\b.jpg"} {
for _, bad := range []string{"../evil.jpg", "/etc/passwd.jpg", "a\\..\\b.jpg", "pag\ne.jpg", "pag\re.jpg"} {
r := zipOf(t, bad)
if _, err := PageIndex(r, int64(r.Len())); err == nil {
t.Fatalf("entry %q must be rejected", bad)