mjordan / islandora_bagger

Tool for generating Bags for Islandora 8 content.
MIT License
4 stars 12 forks source link

Draft-ish: Add a file lookup for media file url #89

Closed DonRichards closed 1 year ago

DonRichards commented 1 year ago

I DO NOT KNOW IF THIS WILL WORK.

This is untested.

I wrote this without having it installed locally. This came from a conversation from slack https://islandora.slack.com/archives/C019U12D44Q/p1674063587768829

The problem

Curl a media object, and it doesn't return the expected $media['field_media_file'][0]['url'] curl -i -X GET 'https://sandbox.islandora.ca/media/107?_format=json'

In AddMedia Line 67-71 it does an "if" statement but not a lookup.

This PR shows a possible solution. It extends the checks, and the fallback does an entity file lookup from the media.

Sorry, in advance. I didn't review this module or test this code to see if it works prior to submitting the PR. I hope this helps in either providing a solution or clarity to the person reporting the initial issue in Slack.

jefferya commented 1 year ago

Plugin tested in a forked codebase with PHP 8.1, Symfony 5.4 (the fork has a few fixed deprecations but shouldn't impact the plugin.

mjordan commented 1 year ago

@DonRichards @jefferya OK to merge into main?

DonRichards commented 1 year ago

I'll leave that question to Jeffery. I assume he's testing it.

jefferya commented 1 year ago

Works for me! Thanks all!

mjordan commented 1 year ago

Thanks to both of you!