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(); let path = path.as_ref();
index += 1; index += 1;
let item_path = if let Some(parent) = path.parent() { let item_path = if let Some(parent) = path.parent() {
let joined_path = parent.join(&segment.uri); if segment.uri.starts_with('/') {
if let Some(s) = joined_path.to_str() { format!("file://{}", segment.uri)
s.to_owned() } 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 { } else {
return Some(Err(RuntimeMsg(format!( let joined_path = parent.join(&segment.uri);
"Failed to convert path to string for `{}`", if let Some(s) = joined_path.to_str() {
joined_path.display() s.to_owned()
)))); } else {
return Some(Err(RuntimeMsg(format!(
"Failed to convert path to string for `{}`",
joined_path.display()
))));
}
} }
} else { } else {
segment.uri.clone() segment.uri.clone()