You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The escaping is wrong when using String.Contains("\\"). It gets translated to e.StringProperty LIKE '%\\%' (escaped only once, but should have been escaped twice for LIKE). Using String.Contains("\\%") correctly translates to e.StringProperty LIKE '%\\\\\\%%'.
By looking at the translator, it seems only strings with wildcard characters are escaped.
Steps to reproduce
The issue
The escaping is wrong when using
String.Contains("\\")
. It gets translated toe.StringProperty LIKE '%\\%'
(escaped only once, but should have been escaped twice for LIKE). UsingString.Contains("\\%")
correctly translates toe.StringProperty LIKE '%\\\\\\%%'
.By looking at the translator, it seems only strings with wildcard characters are escaped.
Pomelo.EntityFrameworkCore.MySql/src/EFCore.MySql/Query/ExpressionTranslators/Internal/MySqlStringComparisonMethodTranslator.cs
Line 479 in b02dd67
\
must be escaped too. There is the same issue forString.StartsWith
andString.EndsWith
.Further technical details
MySQL version: 10.9.8-MariaDB-1:10.9.8+maria~ubu2204
Operating system: Arch Linux, Alpine Linux 3.20, Fedora 40
Pomelo.EntityFrameworkCore.MySql version: 8.0.2
Microsoft.AspNetCore.App version: 8.0.8
The text was updated successfully, but these errors were encountered: