From 4a6e43f418903f10794e06ccc1da681c3c2c49cf Mon Sep 17 00:00:00 2001 From: Jerboa-app Date: Mon, 28 Oct 2024 11:32:05 +0000 Subject: [PATCH] Only add https:// if not present --- src/content/error_page.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/error_page.rs b/src/content/error_page.rs index 53aa466..159de8d 100644 --- a/src/content/error_page.rs +++ b/src/content/error_page.rs @@ -69,7 +69,9 @@ impl ErrorPage { fn expand_template(template: String, config: &Config) -> String { - template.replace("LINK_TO_HOME", &format!("https://{}",&config.domain)) + let mut domain = config.domain.to_string(); + if !domain.starts_with("https://") {domain = format!("https://{domain}")} + template.replace("LINK_TO_HOME", &domain) } pub fn expand_error_code(&self, code: &str) -> String