Skip to content

Fix API path incorrectly parsed

Tan Le requested to merge fix-gitlab-api-path into main

What does this MR do and why?

Without the trailing / in the API route, the v4 segment is removed when calling urljoin (code). This results in incorrect authentication check URL and all PAT authentication fails.

import urllib.parse

bad_base_url = "https://gitlab.com/v4"
good_base_url = "https://gitlab.com/v4/"
end_point = "ml/ai-assist"

urllib.parse.urljoin(good_base_url, end_point)
=> 'https://gitlab.com/api/v4/ml/ai-assist'

urllib.parse.urljoin(bad_base_url, end_point)
=> 'https://gitlab.com/api/ml/ai-assist'

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/420643

Edited by Tan Le

Merge request reports