Fixed a bug where blank DDNS url turned into '/'

This commit is contained in:
Antoine Gersant 2024-10-09 14:53:42 -07:00
parent 524e072e9f
commit 7a84cc0290
2 changed files with 7 additions and 4 deletions

View file

@ -254,11 +254,13 @@ mod test {
use super::*; use super::*;
#[tokio::test] #[tokio::test]
async fn blank_config_is_valid() { async fn blank_config_round_trip() {
let config_path = PathBuf::from_iter(["test-data", "blank.toml"]); let config_path = PathBuf::from_iter(["test-data", "blank.toml"]);
Manager::new(&config_path, auth::Secret([0; 32])) let manager = Manager::new(&config_path, auth::Secret([0; 32]))
.await .await
.unwrap(); .unwrap();
let config: storage::Config = manager.config.read().await.clone().into();
assert_eq!(config, storage::Config::default());
} }
#[tokio::test] #[tokio::test]

View file

@ -111,8 +111,9 @@ async fn get_settings(
ddns_update_url: config_manager ddns_update_url: config_manager
.get_ddns_update_url() .get_ddns_update_url()
.await .await
.unwrap_or_default() .as_ref()
.to_string(), .map(http::Uri::to_string)
.unwrap_or_default(),
}; };
Ok(Json(settings)) Ok(Json(settings))
} }