diff options
author | Jan <king-jan1999@hotmail.de> | 2018-06-13 10:23:57 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-06-13 10:23:57 +0000 |
commit | 1721bbcb013eed3c98c81d615087dd79dddb65be (patch) | |
tree | f9a882623d0a9369333f5ce5544303b7f934122e /lib | |
parent | df2efbdbecb98111bfea23bec1bccfc975ec1328 (diff) | |
download | gitlab-ce-1721bbcb013eed3c98c81d615087dd79dddb65be.tar.gz |
Resolve "Quick actions are case sensitive"
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/quick_actions/extractor.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/quick_actions/substitution_definition.rb | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/gitlab/quick_actions/extractor.rb b/lib/gitlab/quick_actions/extractor.rb index 075ff91700c..30c6806b68e 100644 --- a/lib/gitlab/quick_actions/extractor.rb +++ b/lib/gitlab/quick_actions/extractor.rb @@ -39,7 +39,7 @@ module Gitlab content.delete!("\r") content.gsub!(commands_regex) do if $~[:cmd] - commands << [$~[:cmd], $~[:arg]].reject(&:blank?) + commands << [$~[:cmd].downcase, $~[:arg]].reject(&:blank?) '' else $~[0] @@ -102,14 +102,14 @@ module Gitlab # /close ^\/ - (?<cmd>#{Regexp.union(names)}) + (?<cmd>#{Regexp.new(Regexp.union(names).source, Regexp::IGNORECASE)}) (?: [ ] (?<arg>[^\n]*) )? (?:\n|$) ) - }mx + }mix end def perform_substitutions(content, commands) @@ -120,7 +120,7 @@ module Gitlab end substitution_definitions.each do |substitution| - match_data = substitution.match(content) + match_data = substitution.match(content.downcase) if match_data command = [substitution.name.to_s] command << match_data[1] unless match_data[1].empty? diff --git a/lib/gitlab/quick_actions/substitution_definition.rb b/lib/gitlab/quick_actions/substitution_definition.rb index 032c49ed159..688056e5d73 100644 --- a/lib/gitlab/quick_actions/substitution_definition.rb +++ b/lib/gitlab/quick_actions/substitution_definition.rb @@ -15,7 +15,7 @@ module Gitlab return unless content all_names.each do |a_name| - content.gsub!(%r{/#{a_name} ?(.*)$}, execute_block(action_block, context, '\1')) + content.gsub!(%r{/#{a_name} ?(.*)$}i, execute_block(action_block, context, '\1')) end content end |