fix: share URL respects scheme in OXICLOUD_SERVER_HOST (#103)

When OXICLOUD_SERVER_HOST contains a full URL with scheme (e.g.
https://oxi.example.com), the share link no longer prepends
http:// or appends :port, avoiding malformed URLs like
http://https://host:8085/s/token.

- Add AppConfig::base_url() helper with smart URL construction
- Replace all 6 inline format!() calls in share_service.rs
- Replace inline construction in di.rs (admin settings base URL)
- Priority: OXICLOUD_BASE_URL > full-URL host > http://host:port
This commit is contained in:
Dionisio
2026-02-14 00:18:59 +01:00
parent 82dd7a5c56
commit 099d1d1c55
3 changed files with 29 additions and 9 deletions
+1 -3
View File
@@ -594,9 +594,7 @@ impl AppServiceFactory {
let settings_repo = Arc::new(
crate::infrastructure::repositories::pg::SettingsPgRepository::new(pool.clone())
);
let server_base_url = std::env::var("OXICLOUD_BASE_URL").unwrap_or_else(|_| {
format!("http://{}:{}", self.config.server_host, self.config.server_port)
});
let server_base_url = self.config.base_url();
// Load OIDC config from env vars (the snapshot from startup)
let env_oidc = crate::common::config::OidcConfig::from_env();