diff options
Diffstat (limited to 'app/assets/javascripts/blob/openapi/index.js')
-rw-r--r-- | app/assets/javascripts/blob/openapi/index.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/assets/javascripts/blob/openapi/index.js b/app/assets/javascripts/blob/openapi/index.js index d81aa05c44e..94ae281cada 100644 --- a/app/assets/javascripts/blob/openapi/index.js +++ b/app/assets/javascripts/blob/openapi/index.js @@ -1,12 +1,21 @@ import { setAttributes } from '~/lib/utils/dom_utils'; import axios from '~/lib/utils/axios_utils'; -import { getBaseURL, relativePathToAbsolute, joinPaths } from '~/lib/utils/url_utility'; +import { + getBaseURL, + relativePathToAbsolute, + joinPaths, + setUrlParams, +} from '~/lib/utils/url_utility'; const SANDBOX_FRAME_PATH = '/-/sandbox/swagger'; const getSandboxFrameSrc = () => { const path = joinPaths(gon.relative_url_root || '', SANDBOX_FRAME_PATH); - return relativePathToAbsolute(path, getBaseURL()); + const absoluteUrl = relativePathToAbsolute(path, getBaseURL()); + if (window.gon?.relative_url_root) { + return setUrlParams({ relativeRootPath: window.gon.relative_url_root }, absoluteUrl); + } + return absoluteUrl; }; const createSandbox = () => { |