fix(pdf): export no longer fails on names with å/ä/ö or emoji in the file name (1.89.19)

This commit is contained in:
larssand committed 2026-11-13 16:08:29 +01:00
1 parent eefef11aaa
commit da20a7e978
5 files changed
+29 -4

No files matched your search

@@ -517,6 +517,16 @@ test("PDF export renders Swedish åäö/ÅÄÖ correctly instead of mojibake", {
});
assert.equal(response.status, 200);
assert.equal(response.headers.get("content-type"), "application/pdf");
// A file name with å/ä/ö, # or an emoji may not break the header ("Invalid character in header content").
const named = await fetch(`${baseUrl}/api/export/pdf`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ title: "x", filename: "Höstcupen_Open_#Test2_🏁_A-final.pdf", sections: [{ title: "x", headers: ["a"], rows: [["b"]] }] }),
});
assert.equal(named.status, 200);
const disposition = named.headers.get("content-disposition");
assert.match(disposition, /filename="Hostcupen_Open_#Test2___A-final\.pdf"/);
assert.match(disposition, /filename\*=UTF-8''H%C3%B6stcupen/);
const pdfBuffer = Buffer.from(await response.arrayBuffer());
// The font must declare WinAnsiEncoding - without it a PDF viewer falls back to a standard