prevent crash on empty shell cmd with $ or ! (#240)

This commit is contained in:
Olcan 2025-05-01 13:41:00 -07:00 committed by GitHub
parent a386841947
commit ca53565240
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -41,7 +41,12 @@ export const useShellCommandProcessor = (
return false; return false;
} }
// Remove symbol from rawQuery // Remove symbol from rawQuery
const trimmed = rawQuery.trim().slice(1); const trimmed = rawQuery.trim().slice(1).trimStart();
// Stop if command is empty
if (!trimmed) {
return false;
}
// Add user message *before* execution starts // Add user message *before* execution starts
const userMessageTimestamp = Date.now(); const userMessageTimestamp = Date.now();