Skip to content

Commit 8d4d382

Browse files
committed
rescue chown in case it fails (#3856)
Rescue chown in case it fails so the upload completes as successful.
1 parent f09dc85 commit 8d4d382

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

apps/dashboard/app/models/posix_file.rb

+8-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ def handle_upload(tempfile)
151151
FileUtils.mv tempfile, path.to_s
152152
File.chmod(mode, path.to_s)
153153

154-
path.chown(nil, path.parent.stat.gid) if path.parent.setgid?
154+
begin
155+
gid = path.parent.stat.gid
156+
path.chown(nil, gid) if path.parent.setgid?
157+
rescue StandardError => e
158+
Rails.logger.info("Cannot change group ownership of #{path} to #{gid} because of error: #{e}")
159+
end
160+
161+
nil
155162
end
156163

157164
def can_download_as_zip?(timeout: Configuration.file_download_dir_timeout, download_directory_size_limit: Configuration.file_download_dir_max)

0 commit comments

Comments
 (0)