Merge #19203 Fix Query Generator single quotes and backslashes

- Closes #19203

Hello 👋

This PR fixes the generated query when the criteria text contains single quotes or backslashes.

For now it only escapes the first `single quote` and the first `backslash`, which generates an invalid query.

![Screenshot from 2024-06-19 18-49-43](https://github.com/phpmyadmin/phpmyadmin/assets/60013703/264f2fc9-8d7c-47be-8114-153f6dfbda2f)

After merging this PR it will escape all the `single quotes` and all the `backslashes`.

![Screenshot from 2024-06-19 18-44-15](https://github.com/phpmyadmin/phpmyadmin/assets/60013703/b1050188-7750-4b9e-90a6-a57a6c1f90f6)

- phpMyAdmin version: 5.2.2-dev, 6.0.0-dev

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2024-07-17 12:37:08 -03:00
commit c8525a89d8
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8

View File

@ -438,7 +438,7 @@ Functions.escapeBacktick = function (s) {
* @return {string}
*/
Functions.escapeSingleQuote = function (s) {
return s.replace('\\', '\\\\').replace('\'', '\\\'');
return s.replaceAll('\\', '\\\\').replaceAll('\'', '\\\'');
};
Functions.sprintf = function () {