Skip to content

Commit ed41bb7

Browse files
committed
refacto: simplify creation of the temporary filepath
1 parent b2e831d commit ed41bb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mithril-aggregator/src/services/snapshotter/compressed_archive_snapshotter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl CompressedArchiveSnapshotter {
108108
fn snapshot<T: TarAppender>(&self, filepath: &Path, appender: T) -> StdResult<OngoingSnapshot> {
109109
let temporary_archive_path = self
110110
.ongoing_snapshot_directory
111-
.join(Path::new(&format!("{}.tmp", filepath.display())));
111+
.join(&filepath.with_extension("tmp"));
112112
let archive_path = self.ongoing_snapshot_directory.join(filepath);
113113
if let Some(archive_dir) = archive_path.parent() {
114114
fs::create_dir_all(archive_dir).with_context(|| {
@@ -455,7 +455,7 @@ mod tests {
455455
create_file(&pending_snapshot_directory, "other-process.file");
456456
create_file(&pending_snapshot_directory, "whatever.tar.gz");
457457
// an already existing temporary archive file should be deleted
458-
create_file(&pending_snapshot_directory, "whatever.tar.gz.tmp");
458+
create_file(&pending_snapshot_directory, "whatever.tar.tmp");
459459

460460
let _ = snapshotter
461461
.snapshot_all(Path::new("whatever.tar.gz"))

0 commit comments

Comments
 (0)