Skip to content

Commit fcfefd0

Browse files
authored
Merge pull request #2059 from Kobzol/fix-command-impersonation
Fix command impersonation on Zulip
2 parents 86cc36d + f1b2733 commit fcfefd0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/zulip.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ async fn handle_command<'a>(
179179
message_data: &'a Message,
180180
) -> anyhow::Result<Option<String>> {
181181
log::trace!("handling zulip command {:?}", command);
182-
let words: Vec<&str> = command.split_whitespace().collect();
182+
let mut words: Vec<&str> = command.split_whitespace().collect();
183183

184184
// Missing stream means that this is a direct message
185185
if message_data.stream_id.is_none() {
@@ -200,6 +200,9 @@ async fn handle_command<'a>(
200200
impersonated = true;
201201
gh_id = impersonated_gh_id;
202202
}
203+
204+
// Skip the first two arguments for the rest of CLI parsing
205+
words = words[2..].iter().copied().collect();
203206
} else {
204207
return Err(anyhow::anyhow!(
205208
"Failed to parse command; expected `as <username> <command...>`."

0 commit comments

Comments
 (0)