Update user attachment url
What does this MR do and why?
This code change improves how GitLab imports file attachments from GitHub repositories. The main improvements are:
- Expanded file support: The system now accepts attachments from both "assets" and "files" folders on GitHub, and also supports user-uploaded attachments, making the import process more comprehensive.
- Removed file type restrictions: Previously, the system would reject certain file types during import. Now it accepts all attachment types, making the import more permissive and less likely to fail.
- Cleaner code organization: The attachment processing logic was simplified and reorganized. The method that updates different types of records (like issues, merge requests, releases, and notes) was refactored to be more maintainable and consistent.
- Better caching: Added a step to refresh the markdown cache after updating records, ensuring that the imported content displays correctly.
Overall, these changes make GitHub imports more reliable by accepting more types of attachments and handling them in a more consistent way, while also making the code easier to maintain.
References
Screenshots or screen recordings
| Before | After |
|---|---|
|
|
|
|
How to set up and validate locally
- Ensure you have a github project with images and PDF files in descriptions and comments
- ensure you have a GitHub classic token with
read:orgscope - on the
masterbranch ofgdkcreate a new project by importing from GitHub: New project> Import Project > GitHub - enter your GH token
- ensure
Import Markdown attachments (links)is selected - Import your github project
- Once the import is finished visit it, and confirm the images and attached pdf files in MRs and issues are not properly visible and link to github.com domain URLs
- check out into the
549411-update-image-downloadbranch gdk restart- repeat the import steps, importing the same GH repo, and this time observe that imported images display correctly and link to a
gdkdomain, and pdf files display as linked attachments withgdkdomains
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 #549411 (closed)
Edited by Carla Drago



