From 7ceb4340346594e009df8d1df6e28d11282d70a9 Mon Sep 17 00:00:00 2001 From: Andrew Tatomyr Date: Wed, 11 May 2022 18:21:23 +0200 Subject: [PATCH] fix: wrong base url format causing error when constructing new URL --- src/services/OpenAPIParser.ts | 2 +- src/services/models/Example.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index b9883ff9..66536997 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -58,7 +58,7 @@ export class OpenAPIParser { this.spec = spec; this.allowMergeRefs = spec.openapi.startsWith('3.1'); - const href = IS_BROWSER ? window.location.href : ''; + const href = IS_BROWSER ? window.location.href : undefined; if (typeof specUrl === 'string') { this.specUrl = new URL(specUrl, href).href; } diff --git a/src/services/models/Example.ts b/src/services/models/Example.ts index 016e5caa..1eb81847 100644 --- a/src/services/models/Example.ts +++ b/src/services/models/Example.ts @@ -21,7 +21,7 @@ export class ExampleModel { this.summary = example.summary; this.description = example.description; if (example.externalValue) { - this.externalValueUrl = new URL(example.externalValue, parser.specUrl || '').href; + this.externalValueUrl = new URL(example.externalValue, parser.specUrl).href; } parser.exitRef(infoOrRef);