Set filename when the file is not stored locally
What does this MR do and why?
Set filename when the file is not stored locally.
Follow-up from: https://gitlab.com/gitlab-org/gitlab/-/issues/383060
Testing project (on staging): https://staging.gitlab.com/govern-team-test/yarn-remediation/-/dependencies
Code reference to the distinction between the different storages: https://gitlab.com/gitlab-org/gitlab/-/blob/c8a06a8918b5e09f91526bfbac953da999042d87/lib/api/helpers.rb#L609
Different behaviour across different environments:
Stored Locally:
[9] pry(main)> Dependencies::DependencyListExport.find(2).file.url
=> "/uploads/-/system/dependencies/dependency_list_export/file/2/root-vuln-test_dependencies_2023-01-04T1458.json"
[10] pry(main)> Dependencies::DependencyListExport.find(2).file.file_storage?
=> true
Not stored locally:
[ gstg ] production> Dependencies::DependencyListExport.last.file.url
=> "https://storage.googleapis.com/gitlab-gstg-uploads/dependencies/dependency_list_export/file/2/govern-team-test-yarn-remediation_dependencies_2023-01-04T1455.json?GoogleAccessId=gitlab-object-storage@gitlab-staging-1.iam.gserviceaccount.com&Signature=e7DriMuW8Gn0oW%2FHsCqjd%2BG8G97JuLYBloDcBZJ3zP9jMSMc1rn%2FUMKCfZpt%0AFTGHQV2hQ%2BYsDkZ0q3iMbO8%2BKSiABTjWdsXPUXl2Dhddc%2BhkVPn96OAapo2r%0AK89QdpJHgwG8NffjpR5lyB8LXXSjhCLbiSFv67bkFzMD5CJekaiNCZ5GsVGr%0AHPRkygom3K4xKY1EPTS1wWJRty4GrDoCnHC7vJhxtHgCwqrNVPZBXl%2BtXToB%0AN2ssJ%2Fu5jM6vz6FAZFvwn3WT2uysN7%2FcuxYOk7NwrX8jP3x0Y85dyuOOIhrB%0A%2FkIGOXMicyUUVb8TLsVyFWjyRZpi%2BHvK3w8%2FugRrYw%3D%3D&Expires=1672847989"
[ gstg ] production> Dependencies::DependencyListExport.last.file.file_storage?
=> false
Screenshots or screen recordings
Filename isn't set when file isn't stored locally.
How to set up and validate locally
Unfortunately the issue can't be reproduced via GDK. As this feature is still behind a feature flag (i.e., dependency_list_exporter
), the issue is not present in production.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.