Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
5cd90ef9
Commit
5cd90ef9
authored
Dec 06, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add escaping for milestone values
parent
da8ab2bc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
16 deletions
+22
-16
app/assets/javascripts/filtered_search/dropdown_label.js.es6
app/assets/javascripts/filtered_search/dropdown_label.js.es6
+2
-15
app/assets/javascripts/filtered_search/dropdown_milestone.js.es6
...ets/javascripts/filtered_search/dropdown_milestone.js.es6
+2
-1
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
...vascripts/filtered_search/filtered_search_dropdown.js.es6
+18
-0
No files found.
app/assets/javascripts/filtered_search/dropdown_label.js.es6
View file @
5cd90ef9
...
...
@@ -12,21 +12,8 @@
const dataValueSet = this.setDataValueIfSelected(e.detail.selected);
if (!dataValueSet) {
let labelTitle = e.detail.selected.querySelector('.label-title').innerText.trim();
// Encapsulate label with quotes if it has spaces
if (labelTitle.indexOf(' ') !== -1) {
if (labelTitle.indexOf('"') !== -1) {
// Use single quotes if label title contains double quotes
labelTitle = `'${labelTitle}'`;
} else {
// Known side effect: Label's with both single and double quotes
// won't escape properly
labelTitle = `"${labelTitle}"`;
}
}
const labelName = `~${labelTitle}`;
const labelTitle = e.detail.selected.querySelector('.label-title').innerText.trim();
const labelName = `~${this.getEscapedText(labelTitle)}`;
gl.FilteredSearchManager.addWordToInput(labelName);
}
...
...
app/assets/javascripts/filtered_search/dropdown_milestone.js.es6
View file @
5cd90ef9
...
...
@@ -12,7 +12,8 @@
const dataValueSet = this.setDataValueIfSelected(e.detail.selected);
if (!dataValueSet) {
const milestoneName = `%${e.detail.selected.querySelector('.btn-link').innerText.trim()}`;
const milestoneTitle = e.detail.selected.querySelector('.btn-link').innerText.trim();
const milestoneName = `%${this.getEscapedText(milestoneTitle)}`;
gl.FilteredSearchManager.addWordToInput(this.getSelectedText(milestoneName));
}
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
View file @
5cd90ef9
...
...
@@ -18,6 +18,24 @@
this.dropdown.removeEventListener('click.dl', this.itemClicked.bind(this));
}
getEscapedText(text) {
let escapedText = text;
// Encapsulate value with quotes if it has spaces
if (text.indexOf(' ') !== -1) {
if (text.indexOf('"') !== -1) {
// Use single quotes if value contains double quotes
escapedText = `'${text}'`;
} else {
// Known side effect: values's with both single and double quotes
// won't escape properly
escapedText = `"${text}"`;
}
}
return escapedText;
}
getSelectedText(selectedToken) {
// TODO: Get last word from FilteredSearchTokenizer
const lastWord = this.input.value.split(' ').last();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment