Skip to content

Commit

Permalink
fix(lib/util/filepath): get_relative should not error when trimmed …
Browse files Browse the repository at this point in the history
…path is unchanged (root is unmatched)
  • Loading branch information
comfysage committed Mar 26, 2024
1 parent e9a50cd commit 3f4fb34
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions saku-lib/util/filepath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,5 @@ pub fn parent_dir(path: &str) -> Result<String> {
pub fn get_relative(root: &str, path: &str) -> Result<String> {
let path: String = abs(path)?;
let rel = path.trim_start_matches(&format!("{root}/")).to_string();
if rel == path {
return Err(make_err!());
}
Ok(rel)
}

0 comments on commit 3f4fb34

Please sign in to comment.