mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-12 19:02:19 +02:00
fixed hls rewrite, used redirect url if exists for hls
This commit is contained in:
@@ -41,17 +41,3 @@ pub fn get_trimmed_string(value: &Option<String>) -> Option<String> {
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn replace_after_last_slash(input: &str, replacement: &str) -> String {
|
||||
match input.rsplitn(2, '/').collect::<Vec<&str>>().as_slice() {
|
||||
[_after, before] => {
|
||||
if replacement.starts_with("/") {
|
||||
format!("{before}{replacement}")
|
||||
} else {
|
||||
format!("{before}/{replacement}")
|
||||
}
|
||||
},
|
||||
[_only] => replacement.to_string(), // if there is no slash, replace complete
|
||||
_ => input.to_string(), // fallback, should never happen
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user