Skip to content

Commit

Permalink
Handle PermissionError and FileNotFoundError separately
Browse files Browse the repository at this point in the history
  • Loading branch information
beavailable committed Mar 9, 2022
1 parent a0e7517 commit ca78946
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion share.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,10 @@ def list_dir(self, path):
size = 0
try:
size = os.path.getsize(f)
except:
except PermissionError:
pass
except FileNotFoundError:
continue
files.append((os.path.basename(f), False, self.format_size(size)))
dirs.sort(key=functools.cmp_to_key(lambda s1, s2: self.cmp_path(s1[0], s2[0])))
files.sort(key=functools.cmp_to_key(lambda s1, s2: self.cmp_path(s1[0], s2[0])))
Expand Down

0 comments on commit ca78946

Please sign in to comment.