Skip to content

Commit

Permalink
rescue chown in case it fails (#3856)
Browse files Browse the repository at this point in the history
Rescue chown in case it fails so the upload completes as successful.
  • Loading branch information
johrstrom committed Oct 8, 2024
1 parent f09dc85 commit 8d4d382
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/dashboard/app/models/posix_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8d4d382

Please sign in to comment.