fix: handle relative url case for OAuth
Description
This MR updates Web IDE to gracefully accept both trailing and non-trailing slash URL's for gitlabUrl when constructing OAuth URLs as a follow up to: gitlab!161328 (comment 2034468416).
Screenshot
How to test locally:
-
Pull this branch in
gitlab-web-ide -
There may be an issue with constructing the Web IDE static web assets when generating local development package. Apply the following patch to
gitlabproject:diff --git a/app/assets/javascripts/ide/lib/gitlab_web_ide/get_base_config.js b/app/assets/javascripts/ide/lib/gitlab_web_ide/get_base_config.js index c87d25b2a3f2..f8b6a4526261 100644 --- a/app/assets/javascripts/ide/lib/gitlab_web_ide/get_base_config.js +++ b/app/assets/javascripts/ide/lib/gitlab_web_ide/get_base_config.js @@ -7,9 +7,11 @@ const getGitLabUrl = (gitlabPath = '') => { return cleanEndingSeparator(baseUrlObj.href); }; +const mockPublicPath = '/assets/webpack/gitlab-vscode/0.0.1-dev-20240731185426/'; + export const getBaseConfig = () => ({ // baseUrl - The URL which hosts the Web IDE static web assets - baseUrl: cleanEndingSeparator(getGitLabUrl(process.env.GITLAB_WEB_IDE_PUBLIC_PATH)), + baseUrl: cleanEndingSeparator(getGitLabUrl(mockPublicPath)), // gitlabUrl - The URL for the GitLab instance gitlabUrl: getGitLabUrl(''), }); -
In the
gitlab-web-ideproject, run./scripts/pack-web-ide-package.sh -
Add the development package in the
gitlabproject by runningyarn add <absolute_path_to_local_dev_package>
Edited by Cindy Halim

