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:

  1. 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.
  2. 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.
  3. 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.
  4. 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
image_before

image_after

file_before file_after

How to set up and validate locally

  1. Ensure you have a github project with images and PDF files in descriptions and comments
  2. ensure you have a GitHub classic token with read:org scope
  3. on the master branch of gdk create a new project by importing from GitHub: New project> Import Project > GitHub
  4. enter your GH token
  5. ensure Import Markdown attachments (links) is selected
  6. Import your github project
  7. 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
  8. check out into the 549411-update-image-download branch
  9. gdk restart
  10. repeat the import steps, importing the same GH repo, and this time observe that imported images display correctly and link to a gdk domain, and pdf files display as linked attachments with gdk domains

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

Merge request reports

Loading