Fix playlist filepath generation to ignore already-absolute paths

This commit is contained in:
NGnius (Graham) 2023-12-03 22:22:44 -05:00
parent 9a3919754e
commit 17057accc2

View file

@ -395,14 +395,30 @@ impl FilesystemExecutor {
let path = path.as_ref();
index += 1;
let item_path = if let Some(parent) = path.parent() {
let joined_path = parent.join(&segment.uri);
if let Some(s) = joined_path.to_str() {
s.to_owned()
if segment.uri.starts_with('/') {
format!("file://{}", segment.uri)
} else if segment.uri.starts_with("file:///") {
segment.uri.clone()
} else if segment.uri.starts_with("file://") {
let joined_path = parent.join(&segment.uri.strip_prefix("file://").unwrap());
if let Some(s) = joined_path.to_str() {
s.to_owned()
} else {
return Some(Err(RuntimeMsg(format!(
"Failed to convert path to string for `{}`",
joined_path.display()
))));
}
} else {
return Some(Err(RuntimeMsg(format!(
"Failed to convert path to string for `{}`",
joined_path.display()
))));
let joined_path = parent.join(&segment.uri);
if let Some(s) = joined_path.to_str() {
s.to_owned()
} else {
return Some(Err(RuntimeMsg(format!(
"Failed to convert path to string for `{}`",
joined_path.display()
))));
}
}
} else {
segment.uri.clone()