From 2c68f764e3c6ab58bbf477f2244f0c73f4bb53c5 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 2 Nov 2024 12:57:10 +0100 Subject: [PATCH] added more fixes discovered in a second testing run --- ...48abc3186079b8e1eeb6c24255e6e11bc3847.json | 20 +++++++++++++++++++ server/src/locations/details.rs | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 server/.sqlx/query-6303aef6257038a5fc73c35515248abc3186079b8e1eeb6c24255e6e11bc3847.json diff --git a/server/.sqlx/query-6303aef6257038a5fc73c35515248abc3186079b8e1eeb6c24255e6e11bc3847.json b/server/.sqlx/query-6303aef6257038a5fc73c35515248abc3186079b8e1eeb6c24255e6e11bc3847.json new file mode 100644 index 000000000..682a369cf --- /dev/null +++ b/server/.sqlx/query-6303aef6257038a5fc73c35515248abc3186079b8e1eeb6c24255e6e11bc3847.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT key FROM de", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "key", + "type_info": "Text" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false + ] + }, + "hash": "6303aef6257038a5fc73c35515248abc3186079b8e1eeb6c24255e6e11bc3847" +} diff --git a/server/src/locations/details.rs b/server/src/locations/details.rs index a670c4a94..5ce2490da 100644 --- a/server/src/locations/details.rs +++ b/server/src/locations/details.rs @@ -34,7 +34,7 @@ pub async fn get_handler( None => HttpResponse::NotFound().body("Not found"), Some(d) => { let mut res: LocationDetailsResponse = serde_json::from_value(d).unwrap(); - res.redirect_url = redirect_url; + res.redirect_url = Some(redirect_url); HttpResponse::Ok() .insert_header(CacheControl(vec![ CacheDirective::MaxAge(24 * 60 * 60), // valid for 1d @@ -104,7 +104,7 @@ struct LocationDetailsResponse { /// Where we got our data from, should be displayed at the bottom of any page containing this data sources: Sources, /// The url, this item should be displayed at. Present on both redirects and normal entries, to allow for the common /view/:id path - redirect_url: String, + redirect_url: Option, coords: Coordinate, maps: Maps, #[serde(skip_serializing_if = "Option::is_none")] @@ -451,7 +451,7 @@ mod tests { /// DATABASE_URL=postgres://postgres:CHANGE_ME@localhost:5432 cargo insta test --review --package navigatum-server -- test_get_handler_unchanged --nocapture --include-ignored /// ``` /// - /// This is a *bit* *slow, due to using a [`tokio::task::LocalSet`]. + /// This is a *bit* slow, due to using a [`tokio::task::LocalSet`]. /// Using multiple cores for this might be possible, but optimising this testcase from 10m is currently not worth it #[ignore] #[actix_web::test]