Use isUnsafeLink for xcode protocol
What does this MR do and why?
Root Cause
The issue was in the compact code dropdown component (app/assets/javascripts/repository/components/code_dropdown/compact_code_dropdown.vue
). When creating the Xcode IDE item, it was missing the extraAttrs: { isUnsafeLink: true } attribute that's required for custom protocol schemes like xcode:// to work properly.
The Problem
- The regular code dropdown component correctly included
extraAttrs: { isUnsafeLink: true }
for the Xcode link - The compact code dropdown component (used when the
directory_code_dropdown_updates
feature flag is enabled) was missing this attribute - Without this attribute, the GitLab UI components don't properly handle custom protocol schemes, causing the link to navigate to
about:blank
instead of opening Xcode
The Fix
I updated the compact code dropdown component to include the missing isUnsafeLink attribute:
Before:
if (this.xcodeUrl) {
actions.push({ text: __('Xcode'), href: this.xcodeUrl });
}
After:
if (this.xcodeUrl) {
actions.push({ text: __('Xcode'), href: this.xcodeUrl, extraAttrs: { isUnsafeLink: true } });
}
Files Changed
-
app/assets/javascripts/repository/components/code_dropdown/compact_code_dropdown.vue
- Added the missingextraAttrs: { isUnsafeLink: true }
attribute -
spec/frontend/repository/components/code_dropdown/mock_data.js
- Updated the test mock data to include the new attribute
References
Screenshots or screen recordings
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
- In a project of your choice, make sure you have necessary setup for Xcode (see https://docs.gitlab.com/topics/git/clone/#clone-and-open-in-apple-xcode). If not, you can copy it over from this demo project.
- Open Project overview, for example:
http://gdk.test:8080/flightjs/Flight/
- Click Code to open code dropdown.
- In Open with dropdown group, you should have
Xcode
listed. - Inspect the link and make sure it has a valid URL. It should start with
xcode://clone?repo=ssh
followed by your instance domain and project name.
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.
Related to #571489 (closed)
Edited by Paulina Sedlak-Jakubowska