Skip to content

Commit

Permalink
Merge pull request #3861 from OSC/3.1-file-rescue
Browse files Browse the repository at this point in the history
backport - rescue chown in case it fails (#3856)
  • Loading branch information
johrstrom authored Oct 8, 2024
2 parents f09dc85 + 8d4d382 commit 6361dd7
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 6361dd7

Please sign in to comment.