Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
models: make sure uid is compared case-sensitive
The database collation might vary, so use safer comparing in Python.
- Loading branch information
31c3e0c
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 don't think this change is correct. If you have a case-insensitive column storing the data, then requiring a case-sensitive comparison in python will break some lookups. The correct way to handle this is to either make the column collation case-sensitive, or to case-fold the data on the way in when it is saved or looked up.
31c3e0c
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.
Better solutions are welcome. Doing the column case-sensitive requires MySQL-specific code (all other Django database backends default to case sensitive collations), which I didn't have time and motivation to develop and test.
Case-folding would break the authentication for providers relying on IDs being case-sensitive (and that's what triggered this fix), so it is definitely not an option.