500: Deleted File once attached

Created on 16 November 2021, almost 3 years ago
Updated 8 May 2024, 6 months ago

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.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Diff builder plugins

Created by

πŸ‡ΊπŸ‡ΈUnited States timodwhit

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

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

  • Status changed to Needs work 7 months ago
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    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!

  • First commit to issue fork.
  • Pipeline finished with Success
    6 months ago
    Total: 482s
    #167278
Production build 0.71.5 2024