Skip to content

Commit

Permalink
Don't try to store an Alegre package for an item of "blank" type. (#2214
Browse files Browse the repository at this point in the history
)

This commit fixes an error reported by Sentry.

Fixes: CV2-6150.
  • Loading branch information
caiosba authored Feb 11, 2025
1 parent f7ca752 commit 7d18de9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/concerns/alegre_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ def delete_package_audio(project_media, _field, params)
end

def store_package(project_media, field, params={})
type = get_type(project_media)
return if type.nil?
generic_package(project_media, field).merge(
self.send("store_package_#{get_type(project_media)}", project_media, field, params)
self.send("store_package_#{type}", project_media, field, params)
)
end

Expand Down
7 changes: 7 additions & 0 deletions test/models/bot/alegre_4_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,11 @@ def teardown
end
Bot::Alegre.unstub.stubs(:request)
end

test "should not try to store package for blank item" do
pm = create_project_media media: Blank.create!
assert_nothing_raised do
Bot::Alegre.store_package(pm, 'title')
end
end
end

0 comments on commit 7d18de9

Please sign in to comment.