Skip to content

Commit

Permalink
Merge pull request #53 from diggyk/master
Browse files Browse the repository at this point in the history
Added proper URL encoding of strings for queries
  • Loading branch information
jathanism committed Sep 28, 2015
2 parents 62c8c91 + 04dc2fb commit 0002671
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion hermes/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.3"
__version__ = "0.4.5"
4 changes: 2 additions & 2 deletions hermes/webapp/src/js/controllers/questStatusCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@

if (vm.queryInput) {
options['filterByQuery'] = vm.queryInput;
$location.search('byFilter', vm.queryInput, false);
$location.search('byQuery', vm.queryInput, false);
} else {
$location.search('byFilter', null, false);
$location.search('byQuery', null, false);
}

hermesService.getOpenQuests(options).then(function (questData) {
Expand Down
14 changes: 7 additions & 7 deletions hermes/webapp/src/js/services/hermesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,19 @@
var url = "/api/v1/labors/?open=true&expand=hosts&limit=all&expand=quests&expand=events&expand=eventtypes";

if (options['filterByOwner']) {
url += "&userQuery=" + options['filterByOwner'];
url += "&userQuery=" + encodeURIComponent(options['filterByOwner']);
}

if (options['filterByQuery']) {
url += "&hostQuery=" + options['filterByQuery'];
url += "&hostQuery=" + encodeURIComponent(options['filterByQuery']);
}

if (options['filterByCategory']) {
url += "&category=" + options['filterByCategory']
url += "&category=" + encodeURIComponent(options['filterByCategory']);
}

if (options['filterByState']) {
url += "&state=" + options['filterByState']
url += "&state=" + encodeURIComponent(options['filterByState']);
}

return $http.get(url)
Expand All @@ -146,11 +146,11 @@
var url = "/api/v1/quests?filterClosed=true&progressInfo=true&expand=hosts&expand=labors&limit=all";

if (options['filterByCreator']) {
url += "&byCreator=" + options['filterByCreator'];
url += "&byCreator=" + encodeURIComponent(options['filterByCreator']);
}

if (options['filterByQuery']) {
url += "&hostQuery=" + options['filterByQuery'];
url += "&hostQuery=" + encodeURIComponent(options['filterByQuery']);
}

return $http.get(url)
Expand Down Expand Up @@ -486,7 +486,7 @@
* @returns {*}
*/
function runQuery(queryString) {
return $http.get("/api/v1/extquery?query=" + queryString)
return $http.get("/api/v1/extquery?query=" + encodeURIComponent(queryString))
.then(runQueryComplete)
.catch(runQueryFailed);

Expand Down

0 comments on commit 0002671

Please sign in to comment.