Skip to content

Commit 79a8cda

Browse files
authored
Merge pull request #53 from stoplightio/fix/2385-external-ref-resolution
add check to not convert actual urls
2 parents 8d19b3b + b72c855 commit 79a8cda

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/resolve-external.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ function crawl (obj, path, $refs, options, external, seen) {
7474
else {
7575
if (external && $Ref.is$Ref(obj)) {
7676
/* Correct the reference in the external document so we can resolve it */
77-
let withoutHash = url.stripHash(path);
78-
obj.$ref = url.toFileSystemPath(withoutHash) + obj.$ref;
77+
const withoutHash = url.stripHash(path);
78+
const externalRef = url.isHttp(withoutHash)
79+
? withoutHash
80+
: url.toFileSystemPath(withoutHash);
81+
obj.$ref = externalRef + obj.$ref;
7982
}
8083

8184
for (let key of Object.keys(obj)) {

0 commit comments

Comments
 (0)