Move Crafty server upload to /import/upload

This commit is contained in:
amcmanu3 2023-10-08 10:54:28 -04:00
parent 2f65971261
commit 0296b09547
4 changed files with 11 additions and 5 deletions

1
.gitignore vendored
View File

@ -18,6 +18,7 @@ env.bak/
venv.bak/
.idea/
/import/
/imports/
/servers/
/app/frontend/static/assets/images/auth/custom/

View File

@ -757,11 +757,13 @@ class TasksManager:
)
# Search for old files in imports
self.helper.ensure_dir_exists(
os.path.join(self.controller.project_root, "imports")
os.path.join(self.controller.project_root, "import", "upload")
)
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, "import", "upload")
):
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, "import", file)
):
try:
os.remove(os.path.join(file))

View File

@ -64,7 +64,9 @@ class ApiImportFilesIndexHandler(BaseApiHandler):
# JSON we need to remove this and just send
# the path.
if data["upload"]:
folder = os.path.join(self.controller.project_root, "imports", folder)
folder = os.path.join(
self.controller.project_root, "import", "upload", folder
)
if Helpers.check_file_exists(folder):
folder = self.file_helper.unzip_server(folder, user_id)
root_path = True

View File

@ -102,7 +102,8 @@ class UploadHandler(BaseHandler):
)
self.do_upload = False
path = os.path.join(self.controller.project_root, "imports")
path = os.path.join(self.controller.project_root, "import", "upload")
self.helper.ensure_dir_exists(path)
# Delete existing files
if len(os.listdir(path)) > 0:
for item in os.listdir():