Downcase checksum in with_file_sha256 nuget symbol scope
What does this MR do and why?
The scope .with_file_sha256
in the Packages::Nuget::Symbol
model is searching for the record in the database with the passed sha256 checksum. This checksum is stored in lowercase, but sometimes the scope receives it in uppercase.
In this MR, we make sure that the received checksum (or an array of checksums) are downcased before searching for the matching records in the database.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Open
rails console
and run the following commands to create a symbol file that we can test with:
# stub file upload
def fixture_file_upload(*args, **kwargs)
Rack::Test::UploadedFile.new(*args, **kwargs)
end
package = FactoryBot.create(:nuget_package, project: Project.last)
symbol = FactoryBot.create(:nuget_symbol, package: package)
- Run the scope with uppercased checksum:
Packages::Nuget::Symbol.with_file_sha256(symbol.file_sha256.upcase)
- The symbol record should be returned. On master branch, it will not be found.
Related to #438888 (closed)
Edited by Moaz Khalifa