Skip to content

Commit

Permalink
use url encoding for event-uri passed in path/query for REST API (#183)
Browse files Browse the repository at this point in the history
* URI encode eventURI

* URI encode eventURI - version update

* merge package.json from master
  • Loading branch information
alexei-led authored Apr 23, 2018
1 parent 673dffa commit 3329726
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/logic/api/trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const getPipelineTriggers = async (pipeline) => {

const getEventTriggers = async (event) => {
const options = {
url: `/api/hermes/triggers/event/${event.replace('/', '_slash_')}`,
url: `/api/hermes/triggers/event/${encodeURIComponent(event)}`,
method: 'GET',
};

Expand All @@ -117,7 +117,7 @@ const getEventTriggers = async (event) => {

const createTrigger = async (event, pipeline, filters) => {
const options = {
url: `/api/hermes/triggers/${event.replace('/', '_slash_')}/${pipeline}`,
url: `/api/hermes/triggers/${encodeURIComponent(event)}/${pipeline}`,
method: 'POST',
body: {
filters,
Expand All @@ -129,7 +129,7 @@ const createTrigger = async (event, pipeline, filters) => {

const deleteTrigger = async (event, pipeline) => {
const options = {
url: `api/hermes/triggers/${event.replace('/', '_slash_')}/${pipeline}`,
url: `api/hermes/triggers/${encodeURIComponent(event)}/${pipeline}`,
method: 'DELETE',
};

Expand All @@ -140,7 +140,7 @@ const deleteTrigger = async (event, pipeline) => {

const getEvent = async (event) => {
const options = {
url: `/api/hermes/events/${event.replace('/', '_slash_')}`,
url: `/api/hermes/events/${encodeURIComponent(event)}`,
method: 'GET',
};

Expand All @@ -151,7 +151,7 @@ const getEvent = async (event) => {

const getEvents = async (type, kind, filter, pub) => {
const options = {
url: `/api/hermes/events/?type=${type}&kind=${kind}&filter=${filter.replace('/', '_slash_')}&public=${pub}`,
url: `/api/hermes/events/?type=${type}&kind=${kind}&filter=${encodeURIComponent(filter)}&public=${pub}`,
method: 'GET',
};

Expand Down Expand Up @@ -181,7 +181,7 @@ const createEvent = async (type, kind, secret, values, context, pub) => {

const deleteEvent = async (event, context) => {
const options = {
url: `/api/hermes/events/${event.replace('/', '_slash_')}/${context}`,
url: `/api/hermes/events/${encodeURIComponent(event)}/${context}`,
method: 'DELETE',
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.8.44",
"version": "0.8.45",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit 3329726

Please sign in to comment.