fix(resolve): make retrievalURI absolute before resolution (#9214)
Refs #9208
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="Content-Security-Policy" content="img-src 'self'" />
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<style>
|
||||
|
||||
@@ -154,9 +154,7 @@ export default function SwaggerUI(opts) {
|
||||
spec: {
|
||||
spec: "",
|
||||
// support Relative References
|
||||
url: constructorConfig.url
|
||||
? new URL(constructorConfig.url, document.baseURI).toString()
|
||||
: constructorConfig.url,
|
||||
url: constructorConfig.url,
|
||||
},
|
||||
requestSnippets: constructorConfig.requestSnippets
|
||||
}, constructorConfig.initialState)
|
||||
@@ -193,19 +191,6 @@ export default function SwaggerUI(opts) {
|
||||
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
|
||||
let mergedConfig = deepExtend({}, localConfig, constructorConfig, fetchedConfig || {}, queryConfig)
|
||||
|
||||
// support Relative References in `url` config option
|
||||
if (mergedConfig.url) {
|
||||
mergedConfig.url = new URL(mergedConfig.url, document.baseURI).toString()
|
||||
}
|
||||
|
||||
// support Relative References in `urls` config option
|
||||
if (Array.isArray(mergedConfig.urls)) {
|
||||
mergedConfig.urls = mergedConfig.urls.map(({ url , ...rest}) => ({
|
||||
url: new URL(url, document.baseURI).toString(),
|
||||
...rest,
|
||||
}))
|
||||
}
|
||||
|
||||
// deep extend mangles domNode, we need to set it manually
|
||||
if(domNode) {
|
||||
mergedConfig.domNode = domNode
|
||||
|
||||
@@ -111,7 +111,7 @@ export const resolveSpec = (json, url) => ({specActions, specSelectors, errActio
|
||||
return resolve({
|
||||
fetch,
|
||||
spec: json,
|
||||
baseDoc: url,
|
||||
baseDoc: String(new URL(url, document.baseURI)),
|
||||
modelPropertyMacro,
|
||||
parameterMacro,
|
||||
requestInterceptor,
|
||||
@@ -183,7 +183,7 @@ const debResolveSubtrees = debounce(() => {
|
||||
const batchResult = await systemRequestBatch.reduce(async (prev, path) => {
|
||||
let { resultMap, specWithCurrentSubtrees } = await prev
|
||||
const { errors, spec } = await resolveSubtree(specWithCurrentSubtrees, path, {
|
||||
baseDoc: specSelectors.url(),
|
||||
baseDoc: String(new URL(specSelectors.url(), document.baseURI)),
|
||||
modelPropertyMacro,
|
||||
parameterMacro,
|
||||
requestInterceptor,
|
||||
|
||||
Reference in New Issue
Block a user