diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-31 18:10:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-31 18:10:47 +0300 |
commit | 6f18a8d0b00eae84d262dff137fddd9639f3c52a (patch) | |
tree | f6297c5a843ee6096e996f58c768e80232e2b610 /app/assets/javascripts/blob | |
parent | c62dd5ae440db9ad4696000a863fbcb53fe83498 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/blob')
-rw-r--r-- | app/assets/javascripts/blob/openapi/index.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/assets/javascripts/blob/openapi/index.js b/app/assets/javascripts/blob/openapi/index.js index 2386508aef5..d81aa05c44e 100644 --- a/app/assets/javascripts/blob/openapi/index.js +++ b/app/assets/javascripts/blob/openapi/index.js @@ -1,10 +1,19 @@ import { setAttributes } from '~/lib/utils/dom_utils'; import axios from '~/lib/utils/axios_utils'; +import { getBaseURL, relativePathToAbsolute, joinPaths } 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 createSandbox = () => { const iframeEl = document.createElement('iframe'); + setAttributes(iframeEl, { - src: '/-/sandbox/swagger', + src: getSandboxFrameSrc(), sandbox: 'allow-scripts allow-popups allow-forms', frameBorder: 0, width: '100%', |