mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2025-06-19 07:30:59 +00:00
Fixed some ruff warnings: requests without timeout and naming not complying with PEP
This commit is contained in:
parent
bf18dcbcf9
commit
1c0fb597fb
7 changed files with 25 additions and 31 deletions
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
|
||||
|
||||
class SuspiciousFileOperation(Exception):
|
||||
class SuspiciousFileOperationError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ def path_traversal_check(unsafe_path, known_safe_path):
|
|||
unsafe_path = os.path.abspath(unsafe_path)
|
||||
|
||||
if (os.path.commonprefix([known_safe_path, unsafe_path]) != known_safe_path):
|
||||
raise SuspiciousFileOperation(f"{unsafe_path} is not safe")
|
||||
raise SuspiciousFileOperationError(f"{unsafe_path} is not safe")
|
||||
|
||||
# Passes the check
|
||||
return unsafe_path
|
||||
return unsafe_path
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue