Skip to content

Commit

Permalink
Merge pull request #866 from WGBH-MLA/865-sony-ci-webhook-link-media-…
Browse files Browse the repository at this point in the history
…only

Checks Sony Ci file extension before linking from webhook
  • Loading branch information
bkiahstroud authored Apr 24, 2024
2 parents 7d67200 + afbb9d3 commit d0d015c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/sony_ci/webhooks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit d0d015c

Please sign in to comment.