From 2b2454ea7725fc1e943617da216d0636c305ab85 Mon Sep 17 00:00:00 2001 From: Dennis Schwerdel Date: Wed, 12 Apr 2017 13:57:28 +0200 Subject: [PATCH] Fixed problems with uploads from relative repository paths --- src/bundledb/db.rs | 2 +- src/bundledb/writer.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bundledb/db.rs b/src/bundledb/db.rs index ca3183f..b3b6906 100644 --- a/src/bundledb/db.rs +++ b/src/bundledb/db.rs @@ -259,7 +259,7 @@ impl BundleDb { } let (folder, filename) = self.layout.remote_bundle_path(self.remote_bundles.len()); let dst_path = folder.join(filename); - let src_path = bundle.path; + let src_path = self.layout.base_path().join(bundle.path); bundle.path = dst_path.clone(); if self.uploader.is_none() { self.uploader = Some(BundleUploader::new(5)); diff --git a/src/bundledb/writer.rs b/src/bundledb/writer.rs index 6726d17..2421089 100644 --- a/src/bundledb/writer.rs +++ b/src/bundledb/writer.rs @@ -101,7 +101,7 @@ impl BundleWriter { if let Some(ref encryption) = self.encryption { chunk_data = try!(self.crypto.lock().unwrap().encrypt(&encryption, &chunk_data)); } - let path = db.layout.temp_bundle_path(); + let mut path = db.layout.temp_bundle_path(); let mut file = BufWriter::new(try!(File::create(&path).context(&path as &Path))); try!(file.write_all(&HEADER_STRING).context(&path as &Path)); try!(file.write_all(&[HEADER_VERSION]).context(&path as &Path)); @@ -128,6 +128,7 @@ impl BundleWriter { try!(file.write_all(&info_data).context(&path as &Path)); try!(file.write_all(&chunk_data).context(&path as &Path)); try!(file.write_all(&self.data).context(&path as &Path)); + path = path.strip_prefix(db.layout.base_path()).unwrap().to_path_buf(); Ok(StoredBundle { path: path, info: info }) }