mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-12-18 22:58:42 +08:00
return False by default when there are permission issues
in noHL
This commit is contained in:
parent
07b7350b60
commit
e07c3e417b
1 changed files with 46 additions and 35 deletions
|
|
@ -354,6 +354,7 @@ class CheckHardLinks:
|
|||
This fixes the bug in #192
|
||||
"""
|
||||
check_for_hl = True
|
||||
try:
|
||||
if os.path.isfile(file):
|
||||
logger.trace(f"Checking file: {file}")
|
||||
logger.trace(f"Checking file inum: {os.stat(file).st_ino}")
|
||||
|
|
@ -390,6 +391,16 @@ class CheckHardLinks:
|
|||
largest_file_size * threshold
|
||||
):
|
||||
check_for_hl = False
|
||||
except PermissionError as perm:
|
||||
logger.warning(f"{perm} : file {file} has permission issues.")
|
||||
return False
|
||||
except FileNotFoundError as file_not_found_error:
|
||||
logger.warning(f"{file_not_found_error} : File {file} not found.")
|
||||
return False
|
||||
except Exception as ex:
|
||||
logger.stacktrace()
|
||||
logger.error(ex)
|
||||
return False
|
||||
return check_for_hl
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue