Skip to content
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

[BUG] islandora_entity_view causes WSOD for media without a source file #2110

Closed
seth-shaw-unlv opened this issue May 19, 2022 · 2 comments
Closed
Labels
Type: bug identifies a problem in the software with clear steps to reproduce

Comments

@seth-shaw-unlv
Copy link
Contributor

seth-shaw-unlv commented May 19, 2022

What steps does it take to reproduce the issue?

  • Create a media without a source file (this occurred with a broken migration).
    • Create a media via the UI
    • Jump to the command-line and the interactive terminial drush php:cli
    • Load the media, e.g. $m = \Drupal::entityTypeManager()->getStorage('media')->load(1); (replacing "1" with your test media's ID)
    • Get the source file: $f = \Drupal::service('islandora.media_source_service')->getSourceFile($m);
    • Delete it: $f->delete();
    • Clear your cache
  • Make sure the field_gemini_uri is set to display with the media's default mode
  • Visit the media's page and receive a WSOD

The error occurs because $source_file = $media_source_service->getSourceFile($entity); returns FALSE and the following line, $uri = $source_file->getFileUri(); is trying to call the getFileUri function on a boolean value.

To whom does it occur (anonymous visitor, editor, administrator)?

All

What did you expect to happen?

The media's page should be displayed

Which version of Islandora are you using?

2.x

Any related open or closed issues to this bug report?

None that I found.

@seth-shaw-unlv seth-shaw-unlv added the Type: bug identifies a problem in the software with clear steps to reproduce label May 19, 2022
@seth-shaw-unlv
Copy link
Contributor Author

Throwing in the following check after the getSourceFile call resolves the issue:

        if (!$source_file) {
          \Drupal::logger('islandora')->warning("Can't get source file for " . $entity->label() . "(" . $entity->id() . ")");
          return;
        }

@jordandukart
Copy link
Member

Resolved in Islandora/islandora#874.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug identifies a problem in the software with clear steps to reproduce
Projects
None yet
Development

No branches or pull requests

2 participants