Skip to content

Commit

Permalink
Fix BL-13338, make downloads not show spaces as "+"
Browse files Browse the repository at this point in the history
  • Loading branch information
hatton committed Aug 7, 2024
1 parent acfc570 commit 81804e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/BookDetail/ArtifactHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export function getArtifactUrl(
break;
}
if (!url) return "";

// Whatever writes the `baseUrl` to our books database encodes space as `+` (at least up through now, August 2024).
// This messes up the file name when you download, as you get "Hello+World.pdf".
// So here we just re-encode the `+` as `%20` and when downloaded the file is "Hello World.pdf".
// Since those URLs encode `+` as `%2b`, "one + one = two.pdf" will also to come out correctly.
url = url.replace(/\+/g, "%20");

return url;
}

Expand Down

0 comments on commit 81804e5

Please sign in to comment.