Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
JaneJeon committed Sep 14, 2021
1 parent e862d4b commit f34cc42
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 32 deletions.
44 changes: 14 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"lint:eslint": "eslint ."
},
"dependencies": {
"cacheable-lookup": "^6.0.1",
"cheerio": "^1.0.0-rc.10",
"debug": "^4.3.2",
"got": "^12.0.0-beta.4",
Expand Down
6 changes: 5 additions & 1 deletion utils/normalize-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export default function gen(
}

// always strip trackers for consistency (even if it means worse performance)!
// And don't forget to normalize the end result of stripping tracking for consistency!
debug('stripping trackers from %s', url)
return stripTrackers(url)
return normalizeUrl(stripTrackers(url), {
...normalizeUrlOptions,
...preferredOptions
})
}
}
2 changes: 1 addition & 1 deletion utils/strip-trackers.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function clearUrl(url) {
for (const redir of provider.redirections || []) {
const regex = new RegExp(redir)
const match = regex.exec(url)
if (match.length > 1) {
if (match && match.length > 1) {
url = decodeURIComponent(match[1])
debug('Matched a redirect! %s', url)
}
Expand Down

0 comments on commit f34cc42

Please sign in to comment.