Skip to content

Commit 7f3ccd7

Browse files
committed
fix: create parent dir when exporting from mem store
1 parent fbbf990 commit 7f3ccd7

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)