Skip to content

Commit 9e069c3

Browse files
Fixed a bug with relative URLs
1 parent 6ac104b commit 9e069c3

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

dist/ref-parser.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,11 @@ function read$RefFile($ref, options) {
10231023
function read$RefUrl($ref, options) {
10241024
var u = url.parse($ref.path);
10251025

1026+
if (process.browser && !u.protocol) {
1027+
// Use the protocol of the current page
1028+
u.protocol = url.parse(location.href).protocol;
1029+
}
1030+
10261031
if (u.protocol === 'http:') {
10271032
$ref.pathType = 'http';
10281033
return download(http, u, options);

dist/ref-parser.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ref-parser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ref-parser.min.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/read.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ function read$RefFile($ref, options) {
143143
function read$RefUrl($ref, options) {
144144
var u = url.parse($ref.path);
145145

146+
if (process.browser && !u.protocol) {
147+
// Use the protocol of the current page
148+
u.protocol = url.parse(location.href).protocol;
149+
}
150+
146151
if (u.protocol === 'http:') {
147152
$ref.pathType = 'http';
148153
return download(http, u, options);

0 commit comments

Comments
 (0)