app/jobs/create_derivatives_job.rb in hyrax-3.6.0 vs app/jobs/create_derivatives_job.rb in hyrax-4.0.0.beta1
- old
+ new
@@ -5,12 +5,14 @@
# @param [FileSet] file_set
# @param [String] file_id identifier for a Hydra::PCDM::File
# @param [String, NilClass] filepath the cached file within the Hyrax.config.working_path
def perform(file_set, file_id, filepath = nil)
return if file_set.video? && !Hyrax.config.enable_ffmpeg
- filename = Hyrax::WorkingDirectory.find_or_retrieve(file_id, file_set.id, filepath)
- file_set.create_derivatives(filename)
+ # Ensure a fresh copy of the repo file's latest version is being worked on, if no filepath is directly provided
+ filepath = Hyrax::WorkingDirectory.copy_repository_resource_to_working_directory(Hydra::PCDM::File.find(file_id), file_set.id) unless filepath && File.exist?(filepath)
+
+ file_set.create_derivatives(filepath)
# Reload from Fedora and reindex for thumbnail and extracted text
file_set.reload
file_set.update_index
file_set.parent.update_index if parent_needs_reindex?(file_set)