Skip to content

Multimodal command for gemini#25

Merged
EugeneDraitsev merged 2 commits intomasterfrom
multimodal-command-for-gemini
Mar 3, 2025
Merged

Multimodal command for gemini#25
EugeneDraitsev merged 2 commits intomasterfrom
multimodal-command-for-gemini

Conversation

@EugeneDraitsev
Copy link
Owner

No description provided.

@EugeneDraitsev EugeneDraitsev merged commit 51cbc24 into master Mar 3, 2025
1 of 2 checks passed
@EugeneDraitsev EugeneDraitsev deleted the multimodal-command-for-gemini branch March 3, 2025 16:26
)

return ctx
.replyWithMarkdownV2(message.replace(/([-_\[\]()~>#+={}.!])/g, '\\$1'), {

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to ensure that backslashes are also escaped in the message.replace function. This can be achieved by adding an additional replacement step for backslashes before the existing replacement for other meta-characters. We will use a regular expression with the g flag to ensure all occurrences are replaced.

Suggested changeset 1
src/telegram-bot/src/google/index.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/telegram-bot/src/google/index.ts b/src/telegram-bot/src/google/index.ts
--- a/src/telegram-bot/src/google/index.ts
+++ b/src/telegram-bot/src/google/index.ts
@@ -20,3 +20,3 @@
   return ctx
-    .replyWithMarkdownV2(message.replace(/([-_\[\]()~>#+={}.!])/g, '\\$1'), {
+    .replyWithMarkdownV2(message.replace(/\\/g, '\\\\').replace(/([-_\[\]()~>#+={}.!])/g, '\\$1'), {
       reply_parameters: { message_id: replyId },
EOF
@@ -20,3 +20,3 @@
return ctx
.replyWithMarkdownV2(message.replace(/([-_\[\]()~>#+={}.!])/g, '\\$1'), {
.replyWithMarkdownV2(message.replace(/\\/g, '\\\\').replace(/([-_\[\]()~>#+={}.!])/g, '\\$1'), {
reply_parameters: { message_id: replyId },
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant