Module leaves orphaned file entities upon subsequent node saves

Created on 18 November 2023, 8 months ago
Updated 20 February 2024, 4 months ago

Each time the modules's presave function runs for an entity, a new PDF preview image file entity is generated and the image field is updated to refer to the new file entity. This field update uses a set() method which replaces the file reference. The issue is the original file entity (along with the original file on disk) is left behind no longer associated with anything.

This results in the new file's name getting the numerical sequence appended, i.e. file.jpg becomes file_0.jpg.

The attached patch adds code to clear out any existing files prior to updating the field with the newly generated file.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cameron prince

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024