File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package api
22
33import (
44 "log"
5+ "net/url"
56 "sort"
67 "sync"
78 "time"
@@ -91,8 +92,16 @@ func boolStr(v bool) string {
9192 return "no"
9293}
9394
94- func (h * OutputsHandler ) Delete (c * fiber.Ctx ) error {
95+ func (h * OutputsHandler ) paramID (c * fiber.Ctx ) string {
9596 id := c .Params ("id" )
97+ if decoded , err := url .PathUnescape (id ); err == nil {
98+ return decoded
99+ }
100+ return id
101+ }
102+
103+ func (h * OutputsHandler ) Delete (c * fiber.Ctx ) error {
104+ id := h .paramID (c )
96105 h .controller .RemoveOutput (id )
97106 h .mu .Lock ()
98107 delete (h .outputs , id )
@@ -103,7 +112,7 @@ func (h *OutputsHandler) Delete(c *fiber.Ctx) error {
103112}
104113
105114func (h * OutputsHandler ) Start (c * fiber.Ctx ) error {
106- id := c . Params ( "id" )
115+ id := h . paramID ( c )
107116 var req StartOutputReq
108117 if err := c .BodyParser (& req ); err != nil {
109118 log .Printf ("[api] Output %s body parse warning: %v" , id , err )
@@ -143,7 +152,7 @@ func (h *OutputsHandler) Start(c *fiber.Ctx) error {
143152}
144153
145154func (h * OutputsHandler ) Stop (c * fiber.Ctx ) error {
146- id := c . Params ( "id" )
155+ id := h . paramID ( c )
147156 h .controller .RemoveOutput (id )
148157 log .Printf ("[api] Output stopped: %s" , id )
149158 return c .JSON (APIResponse {Ok : true })
You can’t perform that action at this time.
0 commit comments