Commit 976893ec authored by Clement Ho's avatar Clement Ho

Add support for labels containing single/double quote

parent 8be49531
......@@ -62,10 +62,20 @@
const keyMatch = this.validTokenKeys.filter(v => v.key === tokenKey)[0];
const symbolMatch = this.validTokenKeys.filter(v => v.symbol === tokenSymbol)[0];
if (tokenValue.indexOf('"') !== -1) {
const doubleQuoteIndex = tokenValue.indexOf('"');
const singleQuoteIndex = tokenValue.indexOf('\'');
const doubleQuoteExist = doubleQuoteIndex !== -1;
const singleQuoteExist = singleQuoteIndex !== -1;
if ((doubleQuoteExist && !singleQuoteExist) ||
(doubleQuoteExist && singleQuoteExist && doubleQuoteIndex < singleQuoteIndex)) {
// " is found and is in front of ' (if any)
lastQuotation = '"';
incompleteToken = true;
} else if (tokenValue.indexOf('\'') !== -1) {
} else if ((singleQuoteExist && !doubleQuoteExist) ||
(doubleQuoteExist && singleQuoteExist && singleQuoteIndex < doubleQuoteIndex)) {
// ' is found and is in front of " (if any)
lastQuotation = '\'';
incompleteToken = true;
}
......
......@@ -242,14 +242,12 @@ describe 'Filter issues', feature: true do
end
it 'single quotes containing double quotes' do
# TODO: Actual bug
double_quotes_label = create(:label, project: project, title: 'won"t fix')
double_quotes_label_issue = create(:issue, title: "Issue with double quotes label", project: project)
double_quotes_label_issue.labels << double_quotes_label
# double_quotes_label = create(:label, project: project, title: 'won"t fix')
# double_quotes_label_issue = create(:issue, title: "Issue with double quotes label", project: project)
# double_quotes_label_issue.labels << double_quotes_label
# input_filtered_search("label:'#{double_quotes_label.title}'")
# expect_issues_list_count(1)
input_filtered_search("label:~'#{double_quotes_label.title}'")
expect_issues_list_count(1)
end
it 'double quotes containing single quotes' do
......
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