mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 02:05:53 +01:00
fix(utils): allow for Unicode characters in Content-Disposition
This commit is contained in:
@@ -89,9 +89,15 @@ describe("utils tests", () => {
|
||||
describe("setContentDispositionHeader tests", () => {
|
||||
it("sets Content-Disposition header with specified value", () => {
|
||||
const fileName = "file.txt";
|
||||
const value = `attachment; filename="${fileName}"`;
|
||||
const value = `attachment; filename*=utf-8''${fileName}`;
|
||||
setContentDispositionHeader(fileName, res);
|
||||
expect((res.setHeader as SinonStub).calledOnceWith("Content-Disposition", value));
|
||||
expect((res.setHeader as SinonStub).calledOnceWith("Content-Disposition", value)).to.be.true;
|
||||
});
|
||||
it("sets Content-Disposition header with specified unicode", () => {
|
||||
const fileName = "file.txt";
|
||||
const value = `attachment; filename*=utf-8''${encodeURIComponent(fileName)}`;
|
||||
setContentDispositionHeader(fileName, res);
|
||||
expect((res.setHeader as SinonStub).calledOnceWith("Content-Disposition", value)).to.be.true;
|
||||
});
|
||||
});
|
||||
describe("setCacheControlHeaderNoCache tests", () => {
|
||||
|
||||
Reference in New Issue
Block a user