Skip to content

Commit 328f17a

Browse files
committed
Merge branch 'feat/save_and_load' of https://github.com/Geode-solutions/OpenGeodeWeb-Back into feat/save_and_load
2 parents 3840fc3 + 035802b commit 328f17a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,9 @@ def export_project() -> flask.Response:
301301
for entry in session.query(Data).all()
302302
]
303303

304-
with zipfile.ZipFile(export_zip_path, "w", compression=zipfile.ZIP_DEFLATED) as zip_file:
304+
with zipfile.ZipFile(
305+
export_zip_path, "w", compression=zipfile.ZIP_DEFLATED
306+
) as zip_file:
305307
database_root_path = os.path.join(project_folder, "project.db")
306308
if os.path.isfile(database_root_path):
307309
zip_file.write(database_root_path, "project.db")
@@ -352,8 +354,12 @@ def import_project() -> flask.Response:
352354
with zipfile.ZipFile(zip_file.stream) as zip_archive:
353355
project_folder = os.path.abspath(data_folder_path)
354356
for member in zip_archive.namelist():
355-
target = os.path.abspath(os.path.normpath(os.path.join(project_folder, member)))
356-
if not (target == project_folder or target.startswith(project_folder + os.sep)):
357+
target = os.path.abspath(
358+
os.path.normpath(os.path.join(project_folder, member))
359+
)
360+
if not (
361+
target == project_folder or target.startswith(project_folder + os.sep)
362+
):
357363
flask.abort(400, "Zip contains unsafe paths")
358364
zip_archive.extractall(project_folder)
359365

0 commit comments

Comments
 (0)