diff options
-rw-r--r-- | app/controllers/request_controller.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 11e313caa..efb858adc 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -563,7 +563,9 @@ class RequestController < ApplicationController # which adds a header, so isnt compatible with images that have been # extracted elsewhere from PDFs) FileUtils.mkdir_p(File.dirname(key_path)) - File.open(key_path, 'wb') {|f| f.write(response.body) } + File.atomic_write(key_path) do |f| + f.write(response.body) + end end def get_attachment |