diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-03 12:59:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-03 12:59:43 +0300 |
commit | 6aefeb24873b0957456ae0deacbb431fc79a6a28 (patch) | |
tree | a803343e837f64c2d214a01098fa989097e203cb /lib/gitlab/slash_commands | |
parent | 9d9ee598bc514eaee681b40cdff4d12a3a8f412a (diff) |
Add latest changes from gitlab-org/security/gitlab@14-5-stable-ee
Diffstat (limited to 'lib/gitlab/slash_commands')
-rw-r--r-- | lib/gitlab/slash_commands/deploy.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/gitlab/slash_commands/deploy.rb b/lib/gitlab/slash_commands/deploy.rb index 157d924f99f..9fcefd99f81 100644 --- a/lib/gitlab/slash_commands/deploy.rb +++ b/lib/gitlab/slash_commands/deploy.rb @@ -3,8 +3,18 @@ module Gitlab module SlashCommands class Deploy < BaseCommand + DEPLOY_REGEX = /\Adeploy\s/.freeze + def self.match(text) - /\Adeploy\s+(?<from>\S+.*)\s+to+\s+(?<to>\S+.*)\z/.match(text) + return unless text&.match?(DEPLOY_REGEX) + + from, _, to = text.sub(DEPLOY_REGEX, '').rpartition(/\sto+\s/) + return if from.blank? || to.blank? + + { + from: from.strip, + to: to.strip + } end def self.help_message |