-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PS-2099] PostgreSQL EF Contains() in SQL Query is strpos(), witch is case-sens… #2512
Conversation
Thank you for your contribution! We've added this to our internal Community PR board for review. |
Hi @juliokele thank you so much for this contribution. Did you by chance test this against MySQL to make sure this solution still allowed it to work properly? |
I have tested against MySQL and working properly. |
@@ -28,7 +28,7 @@ public virtual IQueryable<CipherDetails> Run(DatabaseContext dbContext) | |||
DeletedDate = c.DeletedDate, | |||
Reprompt = c.Reprompt, | |||
Favorite = _userId.HasValue && c.Favorites != null && c.Favorites.Contains($"\"{_userId}\":true"), |
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.
Dont we have this same problem here too? I think we do these kinds of checks in some other areas too. @justindbaur UserCipherDetailsQuery
maybe?
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.
yes, the same problem (Favorite is upper-case too):
cipher.Favorites = $"{{\"{cipher.UserId.ToString().ToUpperInvariant()}\":\"true\"}}"; |
@@ -28,7 +28,7 @@ public virtual IQueryable<CipherDetails> Run(DatabaseContext dbContext) | |||
DeletedDate = c.DeletedDate, | |||
Reprompt = c.Reprompt, | |||
Favorite = _userId.HasValue && c.Favorites != null && c.Favorites.Contains($"\"{_userId}\":true"), | |||
FolderId = (_ignoreFolders || !_userId.HasValue || c.Folders == null || !c.Folders.Contains(_userId.Value.ToString())) ? | |||
FolderId = (_ignoreFolders || !_userId.HasValue || c.Folders == null || !c.Folders.ToLowerInvariant().Contains(_userId.Value.ToString())) ? |
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.
Do we need to ensure _userId
is lowercase as well?
@kspearrin |
@juliokele no worries, we're trying to figure out some issues with unsigned commits before being able to merge. |
@justindbaur Should we merge this for next release? |
@kspearrin Yes we should, have we figured out the unsigned commit issue? |
After Items importing the Cipher/Folders value is uppercase.
PostgreSQL EF Contains() under the hood in SQL Query is strpos(), witch is case-sensitive.