Skip to content

Commit

Permalink
Always use original_url in slice media tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
cavis committed Feb 15, 2024
1 parent 0083412 commit 5c4bebc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/tasks/copy_media_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ def media_resource
end

def source_url
media_resource&.href
if media_resource&.slice?
media_resource.original_url
else
media_resource&.href
end
end

def porter_tasks
Expand Down
11 changes: 11 additions & 0 deletions test/models/tasks/copy_media_task_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
assert_equal "whatev", task.source_url
end
end

it "is always the original url for sliced segments" do
task.media_resource.segmentation = [1.23, 4.56]
task.media_resource.original_url = "http://some.where"

assert task.media_resource.slice?

task.media_resource.stub(:href, "http://else.where") do
assert_equal "http://some.where", task.source_url
end
end
end

describe "#porter_tasks" do
Expand Down

0 comments on commit 5c4bebc

Please sign in to comment.