Strip the instance root from Jira Connect unlink paths
What does this MR do and why?
On a self-managed instance served under a relative URL root (for example
https://gitlab.example.com/gitlab), Unlink in the GitLab for Jira
Cloud app fails with "Failed to unlink group. Please try again."
unlink_path is built with jira_connect_subscription_path, which
already includes relative_url_root. When the configuration page is
served by GitLab.com, the frontend also sets the axios baseURL to the
stored instance URL. Axios then joined them into
/gitlab/gitlab/-/jira_connect/subscriptions/:id. The browser blocked
the request as a CSP connect-src violation, so the group stayed
linked. Sign-in, listing groups, and linking were not affected.
This MR leaves the serializer on the relative path and strips the
instance pathname prefix in removeSubscription only when baseURL is
set and the path starts with that root. Axios then requests
/-/jira_connect/subscriptions/:id under the instance URL. Manual
installs and GitLab.com, which do not set baseURL, are unchanged.
The JSON key stays unlink_path.
Frontend specs cover a relative URL root, a trailing slash on the base URL, a path that already omits the root, a path that only starts like the root, no relative root, and an absolute URL.
References
Related: #641176
Related: #618675 (the
reverse inconsistency on groups_path; this MR does not change that
path).