-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The subdirectory path issue in Gitlab API URL #90
Comments
Hey @puff-tw! As you can see in the code we've hardcoded the API url to be in the form of Furthermore I have tried working out a solution where the extension could pickup the relative URL from GitLab itself, but found no luck there. (Was reported by @huzisuke in #77 but closed it due to no feasible solution) |
I'll try working on that in this week, will keep you updated on this issue 😄 Thanks for requesting the feature and helping making SpanTree a better extension 🌳 |
A. site url detect
on gitlab page it has global variable
is this info enough for api url detect? B. ui setting item
if it have to leave a setting entry on GUI, |
rough verify codeseems chrome extension js can't directly access page global variable. // it's based on +var base_url = (document.head.innerHTML.match(/;gon.gitlab_url="(.*?)";/) || [,window.location.origin])[1];
+console.log('---spantree:', base_url);
var r = t(9669)
, i = t.n(r)
, o = t(3955);
const a = {
- baseURL: `${window.location.origin}/api/v4/projects/`
+ baseURL: `${base_url}/api/v4/projects/`
} it works ( via chrome TODO: check URI to defense injection src maybe correspond here |
I send a PR here |
I noticed a 404 error because the Extension was using an incorrect API URL. This is because my Gitlab installation is located in a subdirectory, like this: https://SITE_DOMAIN/gitlab/.
The incorrect URL was:
https://SITE_DOMAIN/api/v4/projects/123/repository/tree?per_page=10000&ref=master
The correct URL is:
https://SITE_DOMAIN/gitlab/api/v4/projects/123/repository/tree?per_page=10000&ref=master
Since Gitlab is installed in a subdirectory, the correct URL needs to include the subdirectory path (/gitlab/) before the api endpoint.
Is it possible to configure the API URL on the Extension itself?
The text was updated successfully, but these errors were encountered: