Skip to content

Commit

Permalink
[Fixes #10142] storage_manager copy dont assign the folder/file permi…
Browse files Browse the repository at this point in the history
…ssions correcly
  • Loading branch information
mattiagiupponi committed Oct 17, 2022
1 parent d29b984 commit 8d1ddd9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions geonode/storage/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def copy_files_list(self, files: List[str]):
# value is always set by default as None
# https://docs.djangoproject.com/en/3.2/ref/settings/#file-upload-directory-permissions
os.chmod(new_path, settings.FILE_UPLOAD_DIRECTORY_PERMISSIONS)

_new_path = None
for f in files:
with self.open(f, 'rb+') as open_file:
old_file_name, _ = os.path.splitext(os.path.basename(f))
Expand All @@ -207,7 +207,8 @@ def copy_files_list(self, files: List[str]):
new_file = f"{new_path}/{old_file_name}_{random_suffix}{ext}"
_new_path = self.copy_single_file(open_file, new_file)
out.append(_new_path)
os.chmod(_new_path, settings.FILE_UPLOAD_PERMISSIONS)
if _new_path:
os.chmod(_new_path, settings.FILE_UPLOAD_PERMISSIONS)
return out

def copy_single_file(self, old_file: BinaryIO, new_file: str):
Expand Down

0 comments on commit 8d1ddd9

Please sign in to comment.