Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rescue chown in case it fails #3856

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 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,13 @@ 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
path.chown(nil, path.parent.stat.gid) if path.parent.setgid?
rescue StandardError => e
Rails.logger.info("cannot chown #{path} because of error: #{e}")
end

nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also ensuring we return nil here because other handle_upload methods return a Transfer.

end

def can_download_as_zip?(timeout: Configuration.file_download_dir_timeout, download_directory_size_limit: Configuration.file_download_dir_max)
Expand Down
Loading