fixed hls rewrite, used redirect url if exists for hls

This commit is contained in:
euzu
2025-04-15 20:16:47 +02:00
parent 3148b943cc
commit c5eeda2a01
6 changed files with 43 additions and 30 deletions
-14
View File
@@ -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
}
}