LB-331: Case insensitive messybrainz #32
LB-331: Case insensitive messybrainz #32
Conversation
messybrainz/data.py
Outdated
if isinstance(value, str): | ||
result[key] = value.lower() | ||
elif isinstace(value, dict): | ||
result[key] = lower(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're doing these list/dict checks then it'd be good to extend the test to include these things too
messybrainz/data.py
Outdated
@@ -144,11 +144,11 @@ def submit_recording(connection, data): | |||
Returns: | |||
the Recording MessyBrainz ID of the data | |||
""" | |||
data_json = json.dumps(data, sort_keys=True, separators=(',', ':')) | |||
data_json = _convert_to_messybrainz_json(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should only convert the data to lower-case while computing the sha.
In this example, data_json
is now lower-case and we insert it into the database like that. This means that
- it's different from what the user submitted
- if we want to use it to show metadata on the website it's now all lower-case and ugly
as we get the artist name and release data from data
, the artist and release data will be original case, but the data in the recording table will be lower-cased
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 !!
4fb6ca7
to
7234e08
Compare
Closing in favor of #56 |
Lowercase everything before working with the database.
We should probably hold off on deploying this until the data we already have is fixed?