Make use of the appropriate destination file

Created on 17 May 2021, almost 4 years ago
Updated 28 April 2023, almost 2 years ago

Problem/Motivation

The FileUpdateService makes a call to file_move which has a default value of renaming the destination file if it already exists.

Meaning that subsequent calls to $plugin->updateUri($uri_new); would be referencing the existing file rather than the new (duplicate) one.

Steps to reproduce

Attempt to rename a file to a name which already exists on disk. The updates will be applied against the existing file name, rather than the current destination.

Proposed resolution

For now, updated the logic to ensure that it makes sure to read and reference the file URI returned from file_move.

In a newer update, an option may be added to allow users to customize the behaviour.
e.g. skipping the file move if it already exists (updating references only), overwriting or renaming.

Remaining tasks

Provide a PR.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

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

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024