Skip to content

Commit 6290a43

Browse files
authored
Merge pull request #707 from IU-Libraries-Joint-Development/essi-2156_prederivation_for_multisegment_filename_r4
[ESSI-2156] fix FileSet#find_or_retrieve for s3 case
2 parents 589a2c5 + cc17b61 commit 6290a43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/models/file_set.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def find_or_retrieve(file_id: original_file&.id, filepath: nil, restore_filename
4949
if restore_filename && (File.basename(filepath) != self.label)
5050
if self.label.present?
5151
original_filepath = filepath.dup
52-
filepath = original_filepath.sub(File.basename(original_filepath), self.label)
52+
filepath = Pathname.new(original_filepath).dirname.join(self.label).to_s
5353
FileUtils.mv(original_filepath, filepath)
5454
else
5555
Rails.logger.warn "FileSet #{self.id} missing label"

0 commit comments

Comments
 (0)