file_manager: always deny access to .git folders
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
d490796da9
commit
a8018afd46
|
@ -251,6 +251,8 @@ class FileManager:
|
|||
if isinstance(req_path, str):
|
||||
req_path = pathlib.Path(req_path)
|
||||
req_path = req_path.expanduser().resolve()
|
||||
if ".git" in req_path.parts:
|
||||
return True
|
||||
for name, (res_path, can_read) in self.reserved_paths.items():
|
||||
if (
|
||||
(res_path == req_path or res_path in req_path.parents) and
|
||||
|
@ -543,6 +545,9 @@ class FileManager:
|
|||
path = pathlib.Path(path)
|
||||
real_path = path.resolve()
|
||||
fstat = path.stat()
|
||||
if ".git" in real_path.parts:
|
||||
permissions = ""
|
||||
else:
|
||||
permissions = "rw"
|
||||
if (
|
||||
root not in self.full_access_roots or
|
||||
|
|
Loading…
Reference in New Issue