diff --git a/app/controllers/sony_ci/webhooks_controller.rb b/app/controllers/sony_ci/webhooks_controller.rb index 674c745f..018074fa 100644 --- a/app/controllers/sony_ci/webhooks_controller.rb +++ b/app/controllers/sony_ci/webhooks_controller.rb @@ -16,6 +16,7 @@ class WebhooksController < ::APIController end def save_sony_ci_id + raise "Asset not playable media" unless is_media? asset.admin_data.update!( sonyci_id: [ sony_ci_id ] ) Hyrax.index_adapter.save(resource: asset) render status: 200, @@ -48,6 +49,10 @@ def sony_ci_id params['assets'].first['id'] end + def is_media? + sony_ci_filename.end_with?('.mp4') || sony_ci_filename.end_with?('.mp3') + end + # Creates a WebhookLog record for the webhook request and ensures # that it gets saved. Used in an around_action controller callback for # webhook actions.