mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-08 13:53:13 +00:00
move Redirect::compute_target to standalone function in web_server.rs
This commit is contained in:
@@ -85,31 +85,6 @@ mod v08 {
|
||||
pub replace_key: Option<String>,
|
||||
}
|
||||
|
||||
impl Redirect {
|
||||
pub fn compute_target(&self, suffix: Option<&str>) -> String {
|
||||
let mut res = String::new();
|
||||
if let Some(hostname) = &self.hostname {
|
||||
if let Some(protocol) = &self.protocol {
|
||||
res.push_str(protocol);
|
||||
res.push_str("://");
|
||||
} else {
|
||||
res.push_str("//");
|
||||
}
|
||||
res.push_str(hostname);
|
||||
}
|
||||
res.push('/');
|
||||
if let Some(replace_key_prefix) = &self.replace_key_prefix {
|
||||
res.push_str(replace_key_prefix);
|
||||
if let Some(suffix) = suffix {
|
||||
res.push_str(suffix)
|
||||
}
|
||||
} else if let Some(replace_key) = &self.replace_key {
|
||||
res.push_str(replace_key)
|
||||
}
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct CorsRule {
|
||||
pub id: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user