Skip to content

Commit

Permalink
bug: Save inner zip files with suffixes - they are expected by core
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomaz-Vieira committed Aug 26, 2024
1 parent ea46132 commit 2f98d54
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bioimg_runtime/src/file_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,19 @@ impl FileSource{
&self,
zip_file: &mut ModelZipWriter<impl Write + Seek>,
) -> Result<rdf::FsPath, ModelPackingError> {
let output_inner_path = rdf::FsPath::unique();
let extension = match self{
Self::LocalFile { path } => path.extension().map(|ex| ex.to_string_lossy().to_string()),
Self::FileInZipArchive { inner_path, .. } => {
inner_path.split(".").last().map(|s| s.to_owned())
},
Self::HttpUrl(url) => {
url.path().split(".").last().map(|s| s.to_owned())
}
};
let output_inner_path = match extension{
Some(ext) => rdf::FsPath::unique_suffixed(&format!(".{ext}")),
None => rdf::FsPath::unique(),
};
zip_file.write_file(&output_inner_path, |writer| -> Result<u64, ModelPackingError>{
let copied_bytes: u64 = match self{
Self::LocalFile { path } => {
Expand Down

0 comments on commit 2f98d54

Please sign in to comment.