From c070dcead538d141fefafc20de988b647f87cab5 Mon Sep 17 00:00:00 2001 From: Mateus Rambo Strey <mars11@inf.ufpr.br> Date: Sun, 13 Mar 2016 22:13:36 -0300 Subject: [PATCH] fix permission in attachment cache worker --- app/workers/attachment_cache_worker.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/workers/attachment_cache_worker.rb b/app/workers/attachment_cache_worker.rb index ac58f88c..61eec509 100644 --- a/app/workers/attachment_cache_worker.rb +++ b/app/workers/attachment_cache_worker.rb @@ -1,5 +1,4 @@ class AttachmentCacheWorker - require 'fileutils' include Sidekiq::Worker sidekiq_options queue: :attachment_cache @@ -16,7 +15,10 @@ class AttachmentCacheWorker file = client.bitstreams.retrieve(id: @attachment.id_dspace).open begin - @attachment.update(cache_link: cache_link) if FileUtils.mkdir_p(directory_root) && FileUtils.mv(file.path, file_root) + FileUtils.mkdir_p(directory_root) + FileUtils.mv(file.path, file_root) + FileUtils.chmod 0644, file_root.to_s, verbose: true + @attachment.update(cache_link: cache_link) ensure file.close if !file.nil? && File.exist?(file.path) end -- GitLab