Skip to content

Commit

Permalink
Join path components instead of replacing characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Johennes committed Jun 5, 2024
1 parent 11a0dd5 commit 9aeff42
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/upload-polarion-attachment/src/file_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ pub(crate) fn guess_document_and_name(
}

if let Ok(document) = Document::try_from(&head) {
let tail = path.components().skip(remainder).collect::<PathBuf>();
let name = tail.to_string_lossy().replace('/', "___");
let name = path
.components()
.skip(remainder)
.map(|c| c.as_os_str().to_string_lossy().to_string())
.collect::<Vec<String>>()
.join("___");
return Ok((document, name));
}

Expand Down

0 comments on commit 9aeff42

Please sign in to comment.