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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d797b03b
Commit
d797b03b
authored
Nov 08, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where spaces would conver into + for all values
parent
3ce7f23a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
...avascripts/filtered_search/filtered_search_manager.js.es6
+9
-7
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
View file @
d797b03b
...
@@ -62,7 +62,11 @@
...
@@ -62,7 +62,11 @@
params.forEach((p) => {
params.forEach((p) => {
const split = p.split('=');
const split = p.split('=');
const key = decodeURIComponent(split[0]);
const key = decodeURIComponent(split[0]);
const value = decodeURIComponent(split[1]);
const value = split[1];
// Sanitize value since URL converts spaces into +
// Replace before decode so that we know what was originally + versus the encoded +
const sanitizedValue = value ? decodeURIComponent(value.replace(/[+]/g, ' ')) : value;
const match = validTokenKeys.find((t) => {
const match = validTokenKeys.find((t) => {
return key === `${t.key}_${t.param}`;
return key === `${t.key}_${t.param}`;
...
@@ -70,22 +74,20 @@
...
@@ -70,22 +74,20 @@
if (match) {
if (match) {
const sanitizedKey = key.slice(0, key.indexOf('_'));
const sanitizedKey = key.slice(0, key.indexOf('_'));
const valueHasSpace =
v
alue.indexOf(' ') !== -1;
const valueHasSpace =
sanitizedV
alue.indexOf(' ') !== -1;
const preferredQuotations = '"';
const preferredQuotations = '"';
let quotationsToUse = preferredQuotations;
let quotationsToUse = preferredQuotations;
if (valueHasSpace) {
if (valueHasSpace) {
// Prefer ", but use ' if required
// Prefer ", but use ' if required
quotationsToUse =
v
alue.indexOf(preferredQuotations) === -1 ? preferredQuotations : '\'';
quotationsToUse =
sanitizedV
alue.indexOf(preferredQuotations) === -1 ? preferredQuotations : '\'';
}
}
inputValue += valueHasSpace ? `${sanitizedKey}:${quotationsToUse}${
value}${quotationsToUse}` : `${sanitizedKey}:${v
alue}`;
inputValue += valueHasSpace ? `${sanitizedKey}:${quotationsToUse}${
sanitizedValue}${quotationsToUse}` : `${sanitizedKey}:${sanitizedV
alue}`;
inputValue += ' ';
inputValue += ' ';
} else if (!match && key === 'search') {
} else if (!match && key === 'search') {
// Sanitize value as URL converts spaces into +
const sanitizedValue = value.replace(/[+]/g, ' ');
inputValue += sanitizedValue;
inputValue += sanitizedValue;
inputValue += ' ';
inputValue += ' ';
}
}
...
@@ -213,7 +215,7 @@
...
@@ -213,7 +215,7 @@
});
});
if (this.searchToken) {
if (this.searchToken) {
path += '&search=' + encodeURIComponent(this.searchToken
.replace(/ /g, '+')
);
path += '&search=' + encodeURIComponent(this.searchToken);
}
}
window.location = path;
window.location = path;
...
...
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