When you save a file programmatically and add it to a file field with the file field path setting configured, the originale file uri doesn't get updated when the file uri is different from the file uri set in filefield_paths_filefield_paths_process_file.
I discovered this by creating a filename with a timestamp, because there was as slight difference in time between saving the file and saving the referencing entity, I think updating the file uri in filefield_paths_filefield_paths_process_file on the original file entity would solve this issue.

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

kensae created an issue. See original summary.

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

voleger’s picture

Title: File uri doesn't get updated on programmatically saved files » Add test to make sure that File URI get updated on programmatically saved files
Status: Active » Postponed (maintainer needs more info)

Is this still relevant? Added a test to cover the provided scenario.

  • voleger committed 0073e40f on 8.x-1.x
    feat: #3477033 Add test to make sure File URI get updated on...