Skip to content

Commit 0fdcd63

Browse files
authored
fix: create parent dir when exporting from mem store (#93)
## Description The `fs` store already created the parent dir of the path passed to `Blobs::export`, but the `mem` store didn't. This copies some lines from the `fs` store to the `mem` store to also create the parent dir there. ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
1 parent fbbf990 commit 0fdcd63

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/store/mem.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,15 @@ async fn export_path_impl(
745745
tx: &mut mpsc::Sender<ExportProgressItem>,
746746
) -> io::Result<()> {
747747
let ExportPathRequest { target, .. } = cmd;
748+
if !target.is_absolute() {
749+
return Err(io::Error::new(
750+
io::ErrorKind::InvalidInput,
751+
"path is not absolute",
752+
));
753+
}
754+
if let Some(parent) = target.parent() {
755+
std::fs::create_dir_all(parent)?;
756+
}
748757
// todo: for partial entries make sure to only write the part that is actually present
749758
let mut file = std::fs::File::create(target)?;
750759
let size = entry.0.state.borrow().size();

0 commit comments

Comments
 (0)