Skip to content

Commit

Permalink
[api-minor] Remove the unused onlyStripPath option from the `getFil…
Browse files Browse the repository at this point in the history
…enameFromUrl` helper function
  • Loading branch information
Snuffleupagus committed May 3, 2024
1 parent 2b69fb7 commit a790f2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 2 additions & 5 deletions src/display/display_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
7 changes: 0 additions & 7 deletions test/unit/display_utils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit a790f2d

Please sign in to comment.