Skip to content

Commit

Permalink
Merge pull request #281 from CanadaHonk/whatwg-url
Browse files Browse the repository at this point in the history
refactor: replace url.parse with new URL
  • Loading branch information
tcort committed Mar 10, 2024
2 parents 0280670 + b75afa1 commit 88a6403
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions markdown-link-check
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ function getInputs() {
stream.on('error', onError);
stream.on('response', onResponse);
try { // extract baseUrl from supplied URL
const parsed = url.parse(filenameOrUrl);
delete parsed.search;
delete parsed.hash;
const parsed = new URL(filenameOrUrl);
parsed.search = '';
parsed.hash = '';
if (parsed.pathname.lastIndexOf('/') !== -1) {
parsed.pathname = parsed.pathname.substr(0, parsed.pathname.lastIndexOf('/') + 1);
}
baseUrl = url.format(parsed);
baseUrl = parsed.toString();
} catch (err) { /* ignore error */
}
} else {
Expand Down

0 comments on commit 88a6403

Please sign in to comment.