Skip to content

Commit e7b0fcc

Browse files
authored
Merge pull request #251 from Geode-solutions/fix/project
Fix/project
2 parents de47178 + 9728067 commit e7b0fcc

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ werkzeug==3.1.8
6060
# flask
6161
# flask-cors
6262

63-
opengeodeweb-microservice==1.*,>=1.1.3

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,11 @@ def export_project() -> flask.Response:
547547
for data_id, native_file in rows:
548548
base_dir = os.path.join(project_folder, data_id)
549549
if os.path.isdir(base_dir):
550-
for f_name in os.listdir(base_dir):
551-
file_path = os.path.join(base_dir, f_name)
552-
if os.path.isfile(file_path):
553-
zip_file.write(file_path, os.path.join(data_id, f_name))
550+
for root, directories, files in os.walk(base_dir):
551+
for file_name in files:
552+
file_path = os.path.join(root, file_name)
553+
relative_path = os.path.relpath(file_path, base_dir)
554+
zip_file.write(file_path, os.path.join(data_id, relative_path))
554555

555556
zip_file.writestr("snapshot.json", flask.json.dumps(params.snapshot))
556557

@@ -622,7 +623,13 @@ def import_project() -> flask.Response:
622623
viewable_name = data.viewable_file
623624
if viewable_name:
624625
vpath = geode_functions.data_file_path(data.id, viewable_name)
625-
if os.path.isfile(vpath):
626+
viewable_dir = os.path.join(data_path, "viewable")
627+
has_components = os.path.isdir(viewable_dir) and bool(
628+
os.listdir(viewable_dir)
629+
)
630+
if os.path.isfile(vpath) and (
631+
data.viewer_object != "model" or has_components
632+
):
626633
continue
627634

628635
native_file = str(data.native_file or "")

0 commit comments

Comments
 (0)