Skip to content

Commit

Permalink
Sorts files during unzip
Browse files Browse the repository at this point in the history
Ensures that unpacked content is sorted before getting handled
  • Loading branch information
ridoo committed Oct 13, 2023
1 parent 7869104 commit 15e4d45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion geonode/storage/data_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def _unzip(self, zip_name: str) -> Mapping:
available_choices = get_allowed_extensions()
not_main_files = ["xml", "sld", "zip", "kmz"]
base_file_choices = [x for x in available_choices if x not in not_main_files]
for _file in Path(self.temporary_folder).iterdir():
sorted_files = sorted(Path(self.temporary_folder).iterdir())
for _file in sorted_files:
if not zipfile.is_zipfile(str(_file)):
if any([_file.name.endswith(_ext) for _ext in base_file_choices]):
self.file_paths["base_file"] = Path(str(_file))
Expand Down

0 comments on commit 15e4d45

Please sign in to comment.