Commit d5926290 authored by Pavlo Dudchenko's avatar Pavlo Dudchenko

204774 Quick actions executed in multiline inline code, when placed on it's own line

parent 2a04cd76
---
title: Fix quick actions executing in multiline inline code when placed on its own line
merge_request: 24933
author: Pavlo Dudchenko
type: fixed
......@@ -105,6 +105,17 @@ module Gitlab
.+?
\n```$
)
|
(?<inline_code>
# Inline code on separate rows:
# `
# Anything, including `/cmd arg` which are ignored by this filter
# `
^.*`\n*
.+?
\n*`$
)
|
(?<html>
# HTML block:
......
......@@ -291,6 +291,33 @@ describe Gitlab::QuickActions::Extractor do
expect(msg).to eq expected
end
it 'does not extract commands in multiline inline code on seperated rows' do
msg = "Hello\r\n`\r\nThis is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld"
expected = msg.delete("\r")
msg, commands = extractor.extract_commands(msg)
expect(commands).to be_empty
expect(msg).to eq expected
end
it 'does not extract commands in multiline inline code starting from text' do
msg = "Hello `This is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld"
expected = msg.delete("\r")
msg, commands = extractor.extract_commands(msg)
expect(commands).to be_empty
expect(msg).to eq expected
end
it 'does not extract commands in inline code' do
msg = "`This is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld"
expected = msg.delete("\r")
msg, commands = extractor.extract_commands(msg)
expect(commands).to be_empty
expect(msg).to eq expected
end
it 'limits to passed commands when they are passed' do
msg = <<~MSG.strip
Hello, we should only extract the commands passed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment