Skip to content

Commit

Permalink
fix #340 clean extra whitespace in generateValidFileName
Browse files Browse the repository at this point in the history
  • Loading branch information
rickdoesdev committed Aug 22, 2024
1 parent a2fd13e commit acaf729
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ function generateValidFileName(title, disallowedChars = null) {
// and non-breaking spaces (thanks @Licat)
var name = title.replace(illegalRe, "").replace(new RegExp('\u00A0', 'g'), ' ');

var name = title.replace(illegalRe, "").replace(new RegExp('\u00A0', 'g'), ' ')
// remove leading/trailing whitespace that can cause issues when using {pageTitle} in a download path
.trim();

if (disallowedChars) {
for (let c of disallowedChars) {
if (`[\\^$.|?*+()`.includes(c)) c = `\\${c}`;
Expand Down

0 comments on commit acaf729

Please sign in to comment.