File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -407,7 +407,8 @@ def get_fs_duplicates(args) -> List[dict]:
407
407
hash_results = list (pool .map (sample_compare .full_hash_file , check_paths ))
408
408
hash_groups = defaultdict (list )
409
409
for path , hash in zip (check_paths , hash_results ):
410
- hash_groups [hash ].append (path )
410
+ if hash is not None :
411
+ hash_groups [hash ].append (path )
411
412
for paths in hash_groups .values ():
412
413
if len (paths ) > 1 :
413
414
keep_path = paths [0 ]
Original file line number Diff line number Diff line change 11
11
def full_hash_file (path ):
12
12
sha256_hash = hashlib .sha256 ()
13
13
14
- with open (path , "rb" ) as file :
15
- for byte_block in iter (lambda : file .read (1048576 ), b"" ):
16
- sha256_hash .update (byte_block )
14
+ try :
15
+ with open (path , "rb" ) as file :
16
+ for byte_block in iter (lambda : file .read (1048576 ), b"" ):
17
+ sha256_hash .update (byte_block )
18
+ except FileNotFoundError :
19
+ return None
17
20
18
21
return sha256_hash .hexdigest ()
19
22
You can’t perform that action at this time.
0 commit comments