Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 527563 - Unencoded search param for 'NameLower' should return 400
  • Loading branch information
mrennie committed Nov 21, 2017
1 parent 253b529 commit d731d7e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/orionode/lib/search.js
Expand Up @@ -136,6 +136,9 @@ module.exports = function(options) {
var searchOpts = new SearchOptions(req.originalUrl, req.contextPath);
buildSearchOptions(searchOpts);

if(!searchOpts.location) {
return api.writeError(400, res);
}
var loc = searchOpts.location;
loc = loc.replace(/^\/file/, "");
loc = loc.replace(/^\/workspace/, "");
Expand Down
14 changes: 14 additions & 0 deletions modules/orionode/test/endpoints/test-search.js
Expand Up @@ -455,6 +455,20 @@ describe("Search endpoint", function() {
});
});
});
it("Parse failure - bug527563", function(done){
testHelper.withWorkspace(request, PREFIX_WORKSPACE, WORKSPACE_ID)
.end(function(err, res) {
testHelper.throwIfError(err);
var sLoc = res.body.Location;
if(Array.isArray(res.body.Projects) && res.body.Projects[0]) {
sLoc = res.body.Projects[0].Location;
}
request()
.get(PREFIX)
.query('sort=Name%20asc&rows=30&start=0&q=NameLower:api.js?onload=loadPicker*+CaseSensitive:true+WholeWord:true+Location:/myserver/prefix/file/foobar@gmail.com-sha1024/javascript/*+Exclude:node_modules&some_extras=one:two:three')
.expect(400, done);
});
});
it("testSearchInProjectWithURLName");
it("testPathWithDBCS");
it("testFileWithDBCS");
Expand Down

0 comments on commit d731d7e

Please sign in to comment.