Skip to content

Commit 01c0152

Browse files
committed
no longer .zip files
1 parent f4bc1d6 commit 01c0152

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,15 @@ def export_project() -> flask.Response:
287287
os.makedirs(project_folder, exist_ok=True)
288288

289289
filename: str = werkzeug.utils.secure_filename(os.path.basename(params.filename))
290-
export_zip_path = os.path.join(project_folder, filename)
290+
if not filename.lower().endswith(".vease"):
291+
flask.abort(400, "Requested filename must end with .vease")
292+
export_vease_path = os.path.join(project_folder, filename)
291293

292294
with get_session() as session:
293295
rows = session.query(Data.id, Data.input_file, Data.additional_files).all()
294296

295297
with zipfile.ZipFile(
296-
export_zip_path, "w", compression=zipfile.ZIP_DEFLATED
298+
export_vease_path, "w", compression=zipfile.ZIP_DEFLATED
297299
) as zip_file:
298300
database_root_path = os.path.join(project_folder, "project.db")
299301
if os.path.isfile(database_root_path):
@@ -317,25 +319,24 @@ def export_project() -> flask.Response:
317319

318320
zip_file.writestr("snapshot.json", flask.json.dumps(params.snapshot))
319321

320-
return utils_functions.send_file(project_folder, [export_zip_path], filename)
322+
return utils_functions.send_file(project_folder, [export_vease_path], filename)
321323

322324

323325
@routes.route(
324326
schemas_dict["import_project"]["route"],
325327
methods=schemas_dict["import_project"]["methods"],
326328
)
327329
def import_project() -> flask.Response:
328-
if flask.request.method == "OPTIONS":
329-
return flask.make_response({}, 200)
330+
# if flask.request.method == "OPTIONS":
331+
# return flask.make_response({}, 200)
330332
utils_functions.validate_request(flask.request, schemas_dict["import_project"])
331333
if "file" not in flask.request.files:
332-
flask.abort(400, "No zip file provided under 'file'")
333-
334+
flask.abort(400, "No .vease file provided under 'file'")
334335
zip_file = flask.request.files["file"]
335336
assert zip_file.filename is not None
336337
filename = werkzeug.utils.secure_filename(os.path.basename(zip_file.filename))
337-
if not filename.lower().endswith(".zip"):
338-
flask.abort(400, "Uploaded file must be a .zip")
338+
if not filename.lower().endswith(".vease"):
339+
flask.abort(400, "Uploaded file must be a .vease")
339340

340341
data_folder_path: str = flask.current_app.config["DATA_FOLDER_PATH"]
341342

0 commit comments

Comments
 (0)