Api#buidlUrl skipped if input is an absolute URL
What does this MR do and why?
Api#buidlUrl skipped if input is an absolute URL
Api#buidlUrl should be used for API paths of type, '/api/v...'. In
case of relative installation,Api#buidlUrl prepends the
relative_url_root, resulting in /[relative_url_root]/api/v....
There is a similar type of method in the backend, expose_url, but the
result is an absolute URL,
http[s]://[domain][port]/[relative_url_root]/api/v....
Engineers should use one or the other, but not both. Using both results in: '/[relative_url_root]/http[s]://[domain][port]/[relative_url_root]/api/v...`
We introduce a modification to the frontend Api#buildUrl to avoid any
modifications if the input is an absolute URL:
- Input: http://gitlab.example.com/api/v... -> Output: http://gitlab.example.com/api/v...
This prevents issues if both frontend and backend functionalities are
used in conjunction, but it also allows Api#buildUrl to be used in
scenarios where API paths and non-API (absolute) URLs want to be used
together. See both examples here:
!195964 (merged)
Changelog: other
References
Screenshots or screen recordings
No changes
How to set up and validate locally
Tests pass.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.