From 88478b335ecc08b7bb8a9033ef4ae3034a00684c Mon Sep 17 00:00:00 2001 From: Garik Asplund Date: Fri, 3 May 2024 17:36:44 -0700 Subject: [PATCH 1/2] Unwrap base URL and minor styling Signed-off-by: Garik Asplund --- src/bartholomew.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bartholomew.rs b/src/bartholomew.rs index af10896..5c32dda 100644 --- a/src/bartholomew.rs +++ b/src/bartholomew.rs @@ -49,8 +49,11 @@ pub fn render(req: Request) -> Result { if let Ok(url) = base_url { config.base_url = Some(url); } - eprintln!("Base URL: {:?}", &config.base_url); - eprintln!("Prepend route info : {:?}", &config.prepend_route_info); + + if let Some(url) = &config.base_url { + eprintln!("Base URL: {}", url); + }; + eprintln!("Prepend route info: {:?}", &config.prepend_route_info); if config.prepend_route_info { let route_info = match req.headers().get("spin-component-route") { @@ -61,7 +64,7 @@ pub fn render(req: Request) -> Result { eprintln!("Updated request path: {:?}", path_info); } - // If a theme is specifed, create theme path + // If a theme is specified, create theme path let theme_dir = if config.theme.is_some() { let mut path: PathBuf = PathBuf::from(THEME_PATH); path.push(config.theme.as_ref().unwrap()); @@ -92,7 +95,7 @@ pub fn render(req: Request) -> Result { // Load the content. let content_path = content::content_path(PathBuf::from(CONTENT_PATH), &path_info); - eprintln!("Path {}", content_path.to_string_lossy()); + eprintln!("Path: {}", content_path.to_string_lossy()); match std::fs::read_to_string(&content_path) { Ok(full_document) => { @@ -176,4 +179,4 @@ pub fn render(req: Request) -> Result { response::not_found(path_info, body) } } -} +} \ No newline at end of file From 36df13576a1c5adf06568da6e8f73c10ee3eabdc Mon Sep 17 00:00:00 2001 From: Garik Asplund Date: Sat, 4 May 2024 08:17:43 -0700 Subject: [PATCH 2/2] ran cargo fmt again Signed-off-by: Garik Asplund --- src/bartholomew.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bartholomew.rs b/src/bartholomew.rs index 5c32dda..4535955 100644 --- a/src/bartholomew.rs +++ b/src/bartholomew.rs @@ -179,4 +179,4 @@ pub fn render(req: Request) -> Result { response::not_found(path_info, body) } } -} \ No newline at end of file +}