If the file was deleted that was once attached to a revision, then a 500 when comparing the two revisions.

Error: Call to a member function getFilename() on null in Drupal\diff\Plugin\diff\Field\FileFieldBuilder->build() (line 40 of modules/contrib/diff/src/Plugin/diff/Field/FileFieldBuilder.php).

Drupal protects against this use case because file deletion doesn't happen ootb with files are removed from revisions on nodes.

However, this can happen if there is custom code to handle it.

Issue fork diff-3249765

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

timodwhit created an issue. See original summary.

odensc’s picture

Status: Active » Reviewed & tested by the community

Thanks @timodwhit! Confirmed this patch fixes the issue on Drupal 10.1.5, PHP 8.1.18, and diff 8.x-1.1.

acbramley’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Thanks for the work on this one. I've recently taken up maintainership of this project and am looking through the RTBC issues.

This fix looks good.

To get this in, I'll need the MR rebase against the latest 8.x-1.x code with tests added.

Thanks!

nuez made their first commit to this issue’s fork.

acbramley’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
acbramley’s picture

Title: 500: Deleted File once attached » Comparing revisions with deleted files throws a 500
Version: 8.x-1.x-dev » 2.x-dev

  • acbramley committed d68f37d3 on 2.x
    Issue #3249765 by acbramley, timodwhit: Comparing revisions with deleted...
acbramley’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.