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

Avoid Infinite Derivatives. #920

Merged
merged 3 commits into from
Dec 14, 2022
Merged

Conversation

rosiel
Copy link
Member

@rosiel rosiel commented Dec 13, 2022

GitHub Issue:

Other Relevant Links (Google Groups discussion, related pull requests,
Release pull requests, etc.)

What does this Pull Request do?

Forbids "normal" derivatives ("normal" i.e. create another media and attach it to my parent node) where the source and target media are the same media.

Example: I have a MP4 that is both my Original File and Service File. Before, i'd be stuck in an infinite loop of replacing the file with worse and worse versions of that video. Now, I know to leave it alone.

What's new?

  • AbstractGenerateDerivative checks and bails if the source media already has the destination term.

  • EmitEvent knows how to catch this exception

  • Trying to be good, I made a new "IslandoraDerivativeException".

  • Does this change add any new dependencies? no

  • Does this change require any other modifications to be made to the repository
    (i.e. Regeneration activity, etc.)? no

  • Could this change impact execution of existing code? yes, in a desirable way.

How should this be tested?

With contexts set up to make service file derivatives, create some content, and a media which is (e.g. image) both Original File and Service File.
Notice messages in the logs about infinite versions of the media.

With this PR:
That doesn't happen. You should get one message in the logs that the derivative was not created.

Screenshot 2022-12-13 at 4 56 05 PM

Documentation Status

  • Does this change existing behaviour that's currently documented? not really
  • Does this change require new pages or sections of documentation? no
  • Who does this need to be documented for?
  • Associated documentation pull request(s): ___ or documentation issue ___

Additional Notes:

Any additional information that you think would be helpful when reviewing this
PR.

Interested parties

Tag (@ mention) interested parties or, if unsure, @Islandora/committers

@rosiel rosiel changed the title Infinite derivs Avoid Infinite Derivatives. Dec 13, 2022
@rosiel
Copy link
Member Author

rosiel commented Dec 13, 2022

Also directly addresses @dannylamb's reply to @nigelgbanks who mentioned this issue in Islandora-Devops/isle-buildkit#248

@nigelgbanks nigelgbanks self-requested a review December 14, 2022 09:41
Copy link
Member

@nigelgbanks nigelgbanks left a comment

Choose a reason for hiding this comment

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

Reviewed and tested, works as intended. Prevents infinite derivatives when a file as both original file and service file, for example.

@nigelgbanks nigelgbanks merged commit db31d14 into Islandora:2.x Dec 14, 2022
@rosiel rosiel deleted the infinite-derivs branch December 14, 2022 13:45
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