From faafed749a9a11e17872563ae161c9d2a508ef84 Mon Sep 17 00:00:00 2001 From: Marco Martins Date: Tue, 7 Nov 2023 20:24:08 +0100 Subject: [PATCH] Update 404 --- src/cockpit_cms_proxy.gleam | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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

", ))) } }