From 5fc01be0bac1394e9a48f1631679485ab5a2fdc4 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Wed, 13 Sep 2023 09:31:51 +0200 Subject: feat(core): add custom HTTP header to provide filename Reason: 'Content-Disposition' header only supports ASCI characters --- .../src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java index 031eeac2..96d02f16 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java @@ -26,6 +26,8 @@ package at.gv.egiz.pdfas.web.servlets; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.Base64; import java.util.Iterator; import java.util.List; import java.util.zip.Deflater; @@ -236,6 +238,11 @@ public class PDFData extends HttpServlet { } response.setHeader("Content-Disposition", "inline;filename=\"" + PdfAsHelper.getPDFFileName(request) + "\""); + + response.setHeader("X-FILENAME-BASE64URL", + Base64.getUrlEncoder().encodeToString( + PdfAsHelper.getPDFFileName(request).getBytes(StandardCharsets.UTF_8))); + final String pdfCert = signedFile.getSignerCertificate(); if (pdfCert != null) { response.setHeader("Signer-Certificate", pdfCert); -- cgit v1.2.3