Skip to content

Commit

Permalink
Small fix due to how sharding works (spacedriveapp#1138)
Browse files Browse the repository at this point in the history
  • Loading branch information
fogodev committed Jul 28, 2023
1 parent aec0c94 commit 26e3b53
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions core/src/object/thumbnail_remover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl ThumbnailRemoverActor {
// thumbnails/
// ├── version.txt
//└── <cas_id>[0..2]/ # sharding
// └── <cas_id>[2..].webp
// └── <cas_id>.webp

let mut read_dir = fs::read_dir(thumbnails_directory)
.await
Expand All @@ -282,14 +282,6 @@ impl ThumbnailRemoverActor {
continue;
}

let entry_path_name = entry_path
.file_name()
.ok_or_else(|| {
ThumbnailRemoverActorError::MissingFileName(entry.path().into_boxed_path())
})?
.to_str()
.ok_or_else(|| NonUtf8PathError(entry.path().into_boxed_path()))?;

let mut thumbnails_paths_by_cas_id = HashMap::new();

let mut entry_read_dir = fs::read_dir(&entry_path)
Expand Down Expand Up @@ -319,8 +311,7 @@ impl ThumbnailRemoverActor {
.to_str()
.ok_or_else(|| NonUtf8PathError(entry.path().into_boxed_path()))?;

thumbnails_paths_by_cas_id
.insert(format!("{}{}", entry_path_name, thumbnail_name), thumb_path);
thumbnails_paths_by_cas_id.insert(thumbnail_name.to_string(), thumb_path);
}

if thumbnails_paths_by_cas_id.is_empty() {
Expand Down

0 comments on commit 26e3b53

Please sign in to comment.