Make nuget symbol files search case-insensitive
Context
In Endpoint for symbol file download (!134564 - merged), we added an endpoint to download the pdb symbol files. To find the file in the packages_nuget_symbols
database table, we use 3 pieces of information we receive in the request:
- file signature
- file name
- file checksum
The search in the database is case-sensitive. So if the file signature
is sent in a different case than the one saved in the database, the server will return 404
. Some users reported that their debuggers are sending those parameters in a different case than the one Gitlab expects.
To avoid this discrepancy in how debuggers (Visual Studio for example) handle the case of the sent parameters, we need to make our search case-insensitive.
What does this MR do?
- Change the search-related scopes in the Packages::Nuget::Symbol model to make them case-insensitive.
- Add a database index on the lowercase version of these columns.
- Update related specs.
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)
# keep a record of the `signature` & `file` name fields of the created symbol.
- Uppercase the
signature
&file
and look for the symbol using the uppercase values:
Packages::Nuget::Symbol.with_signature(uppercase_signature).with_file_name(uppercase_filename)
- The symbol record should be returned. On master branch, it will not be found.
Related to #438888 (closed)