-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: only folderId is needed, default values are managed by the pkg #2
Conversation
…ath using the provided folderId
@@ -101,7 +145,9 @@ | |||
do { | |||
let queryString = `(${parentQueries}) and mimeType != 'application/vnd.google-apps.folder' and trashed = false`; | |||
if (query.trim() !== '') { | |||
queryString += ` and name contains '${query}'`; | |||
// Escape single quotes in query | |||
const sanitizedQuery = query.replace(/'/g, "\\'"); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to ensure that both single quotes and backslashes are properly escaped in the query
string. This can be achieved by using a regular expression that targets both characters and replaces them with their escaped counterparts. Specifically, we should replace single quotes with \'
and backslashes with \\
.
The best way to fix this without changing existing functionality is to update the query.replace
call to handle both single quotes and backslashes. We will use a regular expression that matches both characters and replaces them accordingly.
-
Copy modified lines R148-R149
@@ -147,4 +147,4 @@ | ||
if (query.trim() !== '') { | ||
// Escape single quotes in query | ||
const sanitizedQuery = query.replace(/'/g, "\\'"); | ||
// Escape single quotes and backslashes in query | ||
const sanitizedQuery = query.replace(/\\/g, "\\\\").replace(/'/g, "\\'"); | ||
queryString += ` and name contains '${sanitizedQuery}'`; |
No description provided.