file_manager: reserved path fix
Raise an exception if an attempt is made to access .git folders. Signed-off-by: Eric Callahan <arksine.cde@gmail.com>
This commit is contained in:
parent
6021b39234
commit
fe9a9899e3
|
@ -275,6 +275,10 @@ class FileManager:
|
||||||
req_path = pathlib.Path(req_path)
|
req_path = pathlib.Path(req_path)
|
||||||
req_path = req_path.expanduser().resolve()
|
req_path = req_path.expanduser().resolve()
|
||||||
if ".git" in req_path.parts:
|
if ".git" in req_path.parts:
|
||||||
|
if raise_error:
|
||||||
|
raise self.server.error(
|
||||||
|
"Access to .git folders is forbidden", 403
|
||||||
|
)
|
||||||
return True
|
return True
|
||||||
for name, (res_path, can_read) in self.reserved_paths.items():
|
for name, (res_path, can_read) in self.reserved_paths.items():
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in New Issue