Skip to content

Commit 42f64cb

Browse files
Add regression test for issue #20420
1 parent d1d7d91 commit 42f64cb

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test/integration/viewer_spec.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,40 @@ describe("PDF viewer", () => {
12601260
});
12611261
});
12621262

1263+
describe("File param with encoded characters (issue 20420)", () => {
1264+
let pages;
1265+
1266+
beforeEach(async () => {
1267+
const baseURL = new URL(global.integrationBaseUrl);
1268+
const url = `${baseURL.origin}/build/generic/web/compressed.tracemonkey-pldi-09.pdf?token=%2Ffoo`;
1269+
pages = await loadAndWait(
1270+
encodeURIComponent(url),
1271+
".textLayer .endOfContent"
1272+
);
1273+
});
1274+
1275+
afterEach(async () => {
1276+
await closePages(pages);
1277+
});
1278+
1279+
it("must not double-decode the file param", async () => {
1280+
await Promise.all(
1281+
pages.map(async ([browserName, page]) => {
1282+
const pdfUrl = await page.evaluate(
1283+
() => window.PDFViewerApplication.url
1284+
);
1285+
1286+
expect(pdfUrl)
1287+
.withContext(`In ${browserName}`)
1288+
.toContain("token=%2Ffoo");
1289+
expect(pdfUrl)
1290+
.withContext(`In ${browserName}`)
1291+
.not.toContain("token=/foo");
1292+
})
1293+
);
1294+
});
1295+
});
1296+
12631297
describe("Keyboard scrolling on startup (bug 843653)", () => {
12641298
let pages;
12651299

0 commit comments

Comments
 (0)