Skip to content

Commit cf1ecb1

Browse files
committed
double encode URL path segment: JS encodeURIComponent function does work as expected for path segments
1 parent 3329726 commit cf1ecb1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/logic/api/trigger.js

Lines changed: 5 additions & 5 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/${encodeURIComponent(event)}`,
103+
url: `/api/hermes/triggers/event/${encodeURIComponent(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/${encodeURIComponent(event)}/${pipeline}`,
120+
url: `/api/hermes/triggers/${encodeURIComponent(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/${encodeURIComponent(event)}/${pipeline}`,
132+
url: `api/hermes/triggers/${encodeURIComponent(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/${encodeURIComponent(event)}`,
143+
url: `/api/hermes/events/${encodeURIComponent(encodeURIComponent(event))}`,
144144
method: 'GET',
145145
};
146146

@@ -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/${encodeURIComponent(event)}/${context}`,
184+
url: `/api/hermes/events/${encodeURIComponent(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.45",
3+
"version": "0.8.46",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)