diff --git a/src/main.rs b/src/main.rs index aff6205..29672de 100644 --- a/src/main.rs +++ b/src/main.rs @@ -124,7 +124,10 @@ fn load_config() -> Config { .parse::() .expect("Invalid CHUNK_SIZE_KB") * 1024, - domain: std::env::var("DOMAIN").ok().map(|d| d.trim_end_matches('/').to_string()), + domain: std::env::var("DOMAIN") + .ok() + .map(|d| d.trim().trim_end_matches('/').to_string()) + .filter(|d| !d.is_empty()), } } @@ -226,7 +229,16 @@ async fn list_files(State(state): State) -> Html { .config .domain .clone() + .map(|d| { + if d.contains("://") { + d + } else { + format!("https://{}", d) + } + }) .unwrap_or_else(|| format!("http://localhost:{}", state.config.port)); + + tracing::info!("Using base URL for commands: {}", base_url); let mut file_list_items = String::new();