Skip to content
Snippets Groups Projects
Commit c070dcea authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

fix permission in attachment cache worker

parent bb10d893
No related branches found
No related tags found
No related merge requests found
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment