diff --git a/apps/dashboard/app/models/posix_file.rb b/apps/dashboard/app/models/posix_file.rb index 4d9829874d..ddb911b42d 100644 --- a/apps/dashboard/app/models/posix_file.rb +++ b/apps/dashboard/app/models/posix_file.rb @@ -151,7 +151,14 @@ def handle_upload(tempfile) FileUtils.mv tempfile, path.to_s File.chmod(mode, path.to_s) - path.chown(nil, path.parent.stat.gid) if path.parent.setgid? + begin + gid = path.parent.stat.gid + path.chown(nil, gid) if path.parent.setgid? + rescue StandardError => e + Rails.logger.info("Cannot change group ownership of #{path} to #{gid} because of error: #{e}") + end + + nil end def can_download_as_zip?(timeout: Configuration.file_download_dir_timeout, download_directory_size_limit: Configuration.file_download_dir_max)