-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Improve handling of requests where Media lacks an associated File #1059
Comments
Which is a lot, and based on that I'd probably be inclined to raise the error from the calling method, the context execute function, when the "file" fetched is NULL or FALSE. Would it be valid to islandora/src/Plugin/ContextReaction/JsonldSelfReferenceReaction.php Lines 91 to 95 in c104e45
could become: // Swap media and file urls.
if ($entity instanceof MediaInterface) {
$file = $this->mediaSource->getSourceFile($entity);
if ($file) {
$graph['@id'] = $this->utils->getDownloadUrl($file);
}
} With this change, we end up with the source Media (not File) URL in the same place. I am happy to PR such a change, and go looking for similar in other context reactions, but I'm opening this issue to get a steer on how to approach first. |
@xurizaemon, that seems like a reasonable approach. Please go ahead and submit a PR. |
What steps does it take to reproduce the issue?
/media/123456?_format=jsonld
for that fileOccurs when content is in an invalid state, so this is a feature request.
/media/%mid?_format=jsonld
Error is output. This URL is requested internally from Drupal via
islandora_jsonld_alter_normalized_array()
so the error is typically not visible to end users. The error is visible in Drupal's logs if you look for it.Any user whose browsing triggers the internal request to the
/media/%mid?_format=jsonld
request.Suggest either of:
NotFoundHttpException
from\Drupal\islandora\MediaSource\MediaSourceService::getSourceFile
if no file is returned from$source_list = $media->get($source_field)
. This function already throws such an error if the field is not present (a configuration error), and could throw a similar error for this content error.$this->mediaSource->getSourceFile($entity);
in\Drupal\islandora\Plugin\ContextReaction\JsonldSelfReferenceReaction::execute
and either omit the file data from the JSON response, or throw an error for missing required data.Which version of Islandora are you using?
composer show drupal/islandora
reports 2.12.3Any related open or closed issues to this bug report?
These look related:
Screenshots:
The text was updated successfully, but these errors were encountered: