Skip to content

Commit

Permalink
Ensure .pdf extension for generated document
Browse files Browse the repository at this point in the history
  • Loading branch information
ccjmne committed May 22, 2024
1 parent c9460e6 commit 0ba6177
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function use(puppeteer) {
const { filename, options } = parseRequest(request);
const res = await print({ htmlContents: request.body, browser, options });
await browser.close();
response.attachment(`${filename}`).send(res);
response.attachment(filename.replace(/(?:\.pdf)?$/, '.pdf')).send(res);
});

app.post('/multiple', cors(), async (request, response) => {
Expand Down

0 comments on commit 0ba6177

Please sign in to comment.