Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixes #12728] 3dtiles download does not keep the folder structure #12729

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions geonode/assets/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.http import HttpResponse, StreamingHttpResponse
from django.urls import reverse
from django_downloadview import DownloadResponse
from zipstream import ZipStream, walk
from zipstream import ZipStream

from geonode.assets.handlers import asset_handler_registry, AssetHandlerInterface, AssetDownloadHandlerInterface
from geonode.assets.models import LocalAsset
Expand Down Expand Up @@ -261,9 +261,7 @@ def create_response(
match attachment:
case True:
logger.info(f"Zipping file '{localfile}' with name '{orig_base}'")
zs = ZipStream(sized=True)
for filepath in walk(LocalAssetHandler._get_managed_dir(asset)):
zs.add_path(filepath, os.path.basename(filepath))
zs = ZipStream(sized=True).from_path(LocalAssetHandler._get_managed_dir(asset), arcname="/")
# closing zip for all contents to be written
return StreamingHttpResponse(
zs,
Expand Down
2 changes: 1 addition & 1 deletion geonode/proxy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def download(request, resourceid, sender=Dataset):
register_event(request, "download", instance)
folder = os.path.dirname(dataset_files[0])

zs = ZipStream.from_path(folder)
zs = ZipStream.from_path(folder, arcname="/")
return StreamingHttpResponse(
zs,
content_type="application/zip",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rdflib==6.3.2
smart_open==7.0.4
PyMuPDF==1.24.3
defusedxml==0.7.1
zipstream-ng==1.7.1
zipstream-ng==1.8.0

# Django Apps
django-allauth==0.63.6
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ install_requires =
Deprecated==1.2.14
wrapt==1.16.0
jsonschema==4.22.0
zipstream-ng==1.7.1
zipstream-ng==1.8.0
schema==0.7.7
rdflib==6.3.2
smart_open==7.0.4
Expand Down
Loading