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

Fix WSOD when media source file is missing #834

Merged
merged 1 commit into from
Apr 28, 2021
Merged

Fix WSOD when media source file is missing #834

merged 1 commit into from
Apr 28, 2021

Conversation

seth-shaw-unlv
Copy link

GitHub Ticket: N/A

What does this Pull Request do?

Adds a check to the MediaHasMimetype condition plugin to ensure a source file is found before attempting to call getMimeType() on it. This will only occur in rare instances where a file is missing from the media due to a bad migration (which happened to me) or other system failure.

What's new?

Adds the file variable returned from $this->mediaSource->getSourceFile($medium) (which returns false when no file is found) to the subsequent if statement and before the getMimeType check.

How should this be tested?

  • Setup a condition using the MediaHasMimetype condition
  • Make a node+media where the node would trigger the condition and the media's file field is empty. (Can't be done via the UI.)
  • Visit the node page and experience the WSOD.
  • Apply the PR
  • Visit the node page again; it should load without error.

Interested parties

@Islandora/8-x-committers

Copy link

@dannylamb dannylamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are prudent 👍

@dannylamb
Copy link

Oh, apparently i have to manually kick off the actions now? I guess I'll wait

image

@dannylamb dannylamb merged commit e57c82b into Islandora:8.x-1.x Apr 28, 2021
@seth-shaw-unlv seth-shaw-unlv deleted the media-mimetype-condition-patch branch April 28, 2021 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants