specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
66 stars 36 forks source link

Case sensitivity discrepancy between front/backend uniqueness rules #4058

Open melton-jason opened 1 year ago

melton-jason commented 1 year ago

I am closing this for now. The uniqueness rule has been implemented in v7.9.

However, when verifying this behavior, I did stumble across a bug. The frontend uniqueness rule does its search in a case-sensitive manner while the backend searches and verifies in a case-insensitive way.

For example, if there is a specifyuser called spadmin, the frontend will allow creating a user with name sPadmin, but this will thow a backend exception. This behavior is most likely not specific to this rule, so I will open a new issue (hence the reasoning behind closing this one)

realVinayak commented 1 year ago

@melton-jason uniqueness rules are done in a case-sensitive manner (if done via uniquenessrules.py). Django queries are case-sensitive.

melton-jason commented 1 year ago

Yes you are correct! My apologies for the misunderstanding.

However, the issue still remains, although it is caused by the database and not related to Django.

if there is a specifyuser called spadmin, the frontend will allow creating a user with name sPadmin, but this will thow a backend exception.

The uniqueness rules should be done in a case-insensitive manner.

As far as backend is concerned, this can be solved by using a filter such as iexact

realVinayak commented 1 year ago

Actually, on testing, django filters are case-insensitive!

Correction: MySQL query was case-insensitive is 'utf8mb4_general_ci' which is case insensitive.

emenslin commented 2 months ago

Can recreate in edge (7.9.6)