Allow slashes in slash command arguments

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2017-02-17 10:25:34 +01:00
parent b08be16598
commit 5a0027236b
No known key found for this signature in database
GPG key ID: 46DF07E5CD9E96AB
3 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,4 @@
---
title: Allow slashes in slash command arguments
merge_request:
author:

View file

@ -103,7 +103,7 @@ module Gitlab
(?<cmd>#{Regexp.union(names)}) (?<cmd>#{Regexp.union(names)})
(?: (?:
[ ] [ ]
(?<arg>[^\/\n]*) (?<arg>[^\n]*)
)? )?
(?:\n|$) (?:\n|$)
) )

View file

@ -81,6 +81,14 @@ describe Gitlab::SlashCommands::Extractor do
let(:original_msg) { "/assign @joe\nworld" } let(:original_msg) { "/assign @joe\nworld" }
let(:final_msg) { "world" } let(:final_msg) { "world" }
end end
it 'allows slash in command arguments' do
msg = "/assign @joe / @jane\nworld"
msg, commands = extractor.extract_commands(msg)
expect(commands).to eq [['assign', '@joe / @jane']]
expect(msg).to eq 'world'
end
end end
context 'in the middle of content' do context 'in the middle of content' do