labrinth
labrinth copied to clipboard
POST `/version_files/update` still requires lowercase hashes
Describe the bug
I'm still getting this same issue. It was reported in https://github.com/modrinth/labrinth/issues/369 (she's not fine) and was said to be fixed:
fixed by #374 Originally posted by @Geometrically in https://github.com/modrinth/labrinth/issues/369#issuecomment-1159309559
Here are two requests that demonstrate the issue, tested on Postman:
curl --location 'https://api.modrinth.com/v2/version_files/update' \
--header 'Content-Type: application/json' \
--data '{
"loaders": ["fabric"],
"game_versions": ["1.19.2"],
"algorithm": "sha1",
"hashes": ["5F978F794395C44F1F4AA5C7D28B5D74113A605A"]
}'
this request returns nothing, while this one works:
curl --location 'https://api.modrinth.com/v2/version_files/update' \
--header 'Content-Type: application/json' \
--data '{
"loaders": ["fabric"],
"game_versions": ["1.19.2"],
"algorithm": "sha1",
"hashes": ["5f978f794395c44f1f4aa5c7d28b5d74113a605a"]
}'
Steps to reproduce
- Get a sample hash to test the endpoint with. The following hash is for the mod
AdvancedChatCore
: 5F978F794395C44F1F4AA5C7D28B5D74113A605A - Convert the hash to lowercase: 5f978f794395c44f1f4aa5c7d28b5d74113a605a
- Test the endpoint once with uppercase, and observe the result.
"loaders": ["fabric"],
"game_versions": ["1.19.2"],
"algorithm": "sha1",
"hashes": ["5F978F794395C44F1F4AA5C7D28B5D74113A605A"]
- Test the endpoint once with lowercase, and inspect the response.
"loaders": ["fabric"],
"game_versions": ["1.19.2"],
"algorithm": "sha1",
"hashes": ["5f978f794395c44f1f4aa5c7d28b5d74113a605a"]
Expected behavior
The response:
{
"5f978f794395c44f1f4aa5c7d28b5d74113a605a": {
/* ... */
}
}
should be returned regardless of the case of the hash, as most tools, libraries, and frameworks calculate hashes in varying formats!
Additional context
No response