diff --git a/src/cockpit_cms_proxy.gleam b/src/cockpit_cms_proxy.gleam index d33b47f..971b480 100644 --- a/src/cockpit_cms_proxy.gleam +++ b/src/cockpit_cms_proxy.gleam @@ -33,7 +33,7 @@ fn handle_website(handler: Website) -> Response(ResponseData) { Error(_) -> response.new(404) |> response.set_body(mist.Bytes(bit_builder.from_string( - "

Not Found

Website route " <> handler.path <> "`` not found

", + "

Not Found

Website route " <> handler.path <> " not found

", ))) } } @@ -43,11 +43,10 @@ type Image { } fn handle_images(handler: Image) -> Response(ResponseData) { + let path = string.join(handler.path, "/") + let query = unwrap(handler.query, "") let url = - "/api/cockpit/image?token=" <> handler.config.api_token <> "&src=" <> handler.config.base_url <> "/storage/uploads/" <> string.join( - handler.path, - "/", - ) <> "&" <> unwrap(handler.query, "") + "/api/cockpit/image?token=" <> handler.config.api_token <> "&src=" <> handler.config.base_url <> "/storage/uploads/" <> path <> "&" <> query let result = request.new() @@ -63,7 +62,7 @@ fn handle_images(handler: Image) -> Response(ResponseData) { Error(_) -> response.new(404) |> response.set_body(mist.Bytes(bit_builder.from_string( - "

Not Found

Image " <> handler.path <> "`` not found

", + "

Not Found

Image " <> path <> " not found

", ))) } }