mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Make it so a user cannot upload anything but zip
TODO add better feedback than "error"
This commit is contained in:
parent
f090bf8c6f
commit
a21bb36f7c
@ -673,9 +673,9 @@ class TasksManager:
|
||||
user.id, {"pfp": self.helper.get_gravatar_image(user.email)}
|
||||
)
|
||||
# Search for old files in imports
|
||||
for file in os.listdir(os.path.join(self.controller.project_root), "imports"):
|
||||
for file in os.listdir(os.path.join(self.controller.project_root, "imports")):
|
||||
if self.helper.is_file_older_than_x_days(
|
||||
os.path.join(self.controller.project_root), "imports", file
|
||||
os.path.join(self.controller.project_root, "imports", file)
|
||||
):
|
||||
try:
|
||||
os.remove(os.path.join(file))
|
||||
|
@ -109,6 +109,9 @@ class UploadHandler(BaseHandler):
|
||||
|
||||
self.helper.ensure_dir_exists(path)
|
||||
filename = self.request.headers.get("X-FileName", None)
|
||||
if not str(filename).endswith(".zip"):
|
||||
self.helper.websocket_helper.broadcast("close_upload_box", "error")
|
||||
self.finish("error")
|
||||
full_path = os.path.join(path, filename)
|
||||
|
||||
if self.do_upload:
|
||||
|
Loading…
Reference in New Issue
Block a user