diff --git a/src/display/display_utils.js b/src/display/display_utils.js index 67213232306ce..adf9cbdea9d72 100644 --- a/src/display/display_utils.js +++ b/src/display/display_utils.js @@ -803,13 +803,10 @@ function isPdfFile(filename) { /** * Gets the filename from a given URL. * @param {string} url - * @param {boolean} [onlyStripPath] * @returns {string} */ -function getFilenameFromUrl(url, onlyStripPath = false) { - if (!onlyStripPath) { - [url] = url.split(/[#?]/, 1); - } +function getFilenameFromUrl(url) { + [url] = url.split(/[#?]/, 1); return url.substring(url.lastIndexOf("/") + 1); } diff --git a/test/unit/display_utils_spec.js b/test/unit/display_utils_spec.js index 374f4b24f2db2..1d684bfd7b9de 100644 --- a/test/unit/display_utils_spec.js +++ b/test/unit/display_utils_spec.js @@ -189,13 +189,6 @@ describe("display_utils", function () { const url = "https://server.org/filename.pdf?foo=bar"; expect(getFilenameFromUrl(url)).toEqual("filename.pdf"); }); - - it("should get the filename from a relative URL, keeping the anchor", function () { - const url = "../../part1#part2.pdf"; - expect(getFilenameFromUrl(url, /* onlyStripPath = */ true)).toEqual( - "part1#part2.pdf" - ); - }); }); describe("getPdfFilenameFromUrl", function () {