Skip to content

Commit 3329726

Browse files
authored
use url encoding for event-uri passed in path/query for REST API (#183)
* URI encode eventURI * URI encode eventURI - version update * merge package.json from master
1 parent 673dffa commit 3329726

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/logic/api/trigger.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const getPipelineTriggers = async (pipeline) => {
100100

101101
const getEventTriggers = async (event) => {
102102
const options = {
103-
url: `/api/hermes/triggers/event/${event.replace('/', '_slash_')}`,
103+
url: `/api/hermes/triggers/event/${encodeURIComponent(event)}`,
104104
method: 'GET',
105105
};
106106

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

118118
const createTrigger = async (event, pipeline, filters) => {
119119
const options = {
120-
url: `/api/hermes/triggers/${event.replace('/', '_slash_')}/${pipeline}`,
120+
url: `/api/hermes/triggers/${encodeURIComponent(event)}/${pipeline}`,
121121
method: 'POST',
122122
body: {
123123
filters,
@@ -129,7 +129,7 @@ const createTrigger = async (event, pipeline, filters) => {
129129

130130
const deleteTrigger = async (event, pipeline) => {
131131
const options = {
132-
url: `api/hermes/triggers/${event.replace('/', '_slash_')}/${pipeline}`,
132+
url: `api/hermes/triggers/${encodeURIComponent(event)}/${pipeline}`,
133133
method: 'DELETE',
134134
};
135135

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

141141
const getEvent = async (event) => {
142142
const options = {
143-
url: `/api/hermes/events/${event.replace('/', '_slash_')}`,
143+
url: `/api/hermes/events/${encodeURIComponent(event)}`,
144144
method: 'GET',
145145
};
146146

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

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

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

182182
const deleteEvent = async (event, context) => {
183183
const options = {
184-
url: `/api/hermes/events/${event.replace('/', '_slash_')}/${context}`,
184+
url: `/api/hermes/events/${encodeURIComponent(event)}/${context}`,
185185
method: 'DELETE',
186186
};
187187

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.8.44",
3+
"version": "0.8.45",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)