Skip to content

Commit

Permalink
fix: properly calculate relative paths (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Feb 17, 2019
1 parent 75f48ec commit aa2e9c9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"cheerio": "^1.0.0-rc.2",
"ecstatic": "^3.3.1",
"gaxios": "^1.7.0",
"is-absolute-url": "^2.1.0",
"meow": "^5.0.0",
"server-destroy": "^1.0.1",
"update-notifier": "^2.5.0"
Expand All @@ -33,7 +32,6 @@
"@commitlint/cli": "^7.5.2",
"@commitlint/config-conventional": "^7.5.0",
"@types/cheerio": "^0.22.10",
"@types/is-absolute-url": "^2.1.0",
"@types/meow": "^5.0.0",
"@types/mocha": "^5.2.6",
"@types/nock": "^9.3.1",
Expand Down
3 changes: 1 addition & 2 deletions src/links.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as cheerio from 'cheerio';
import isAbsoluteUrl = require('is-absolute-url');
import {URL} from 'url';

const linksAttr = {
Expand Down Expand Up @@ -34,7 +33,7 @@ export function getLinks(source: string, baseUrl: string) {
}

function normalizeLink(link: string, baseUrl: string): URL {
const slink = isAbsoluteUrl(link) ? new URL(link) : (new URL(link, baseUrl));
const slink = new URL(link, baseUrl);
slink.hash = '';
return slink;
}

0 comments on commit aa2e9c9

Please sign in to comment.