diff --git a/lib/logic/api/trigger.js b/lib/logic/api/trigger.js index 746cadedb..c9dc6d475 100644 --- a/lib/logic/api/trigger.js +++ b/lib/logic/api/trigger.js @@ -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', }; @@ -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, @@ -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', }; @@ -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', }; @@ -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', }; @@ -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', }; diff --git a/package.json b/package.json index 4a63c5d4b..d4face56b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.8.44", + "version": "0.8.45", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true,