From 2c36373d85a15625649558a9a27115abea83c33b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Mon, 7 Feb 2022 10:23:17 +0100 Subject: [PATCH] fix redirect to "/" in /api/thumb --- src/routes.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes.rs b/src/routes.rs index 950401a..6fc4373 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -151,7 +151,7 @@ pub async fn get_thumbnail( } else { return Ok(Either::B( HttpResponse::SeeOther() - .header(http::header::LOCATION, format!("/api/raw/{hash}")) + .header(http::header::LOCATION, format!("../../api/raw/{hash}")) .finish(), )); } @@ -393,7 +393,7 @@ pub async fn list_hier( let connection = state.upend.connection().map_err(ErrorInternalServerError)?; if path.is_empty() { Ok(HttpResponse::MovedPermanently() - .header("Location", "/api/hier_roots") + .header(http::header::LOCATION, "../../api/hier_roots") .finish()) } else { let upath: UHierPath = path.into_inner().parse().map_err(ErrorBadRequest)?; @@ -403,7 +403,7 @@ pub async fn list_hier( let path = resolve_path(&connection, &upath, false).map_err(ErrorNotFound)?; match path.last() { Some(addr) => Ok(HttpResponse::Found() - .header("Location", format!("/api/obj/{}", addr)) + .header(http::header::LOCATION, format!("../../api/obj/{}", addr)) .finish()), None => Ok(HttpResponse::NotFound().finish()), }