Might be an idea to create a second safer replace option that will only replace existing files that either don't have any current usages on other entities, or that are currently attached to the saved version of the entity we're updating. For either option we'd just fallback to renaming if we deem the file not replaceable.

Comments

drclaw created an issue.

joelpittet’s picture

What about an option to do what https://www.drupal.org/project/upload_replace does for revisions? Or is that what you're meaning? See the ASCII art on the project page for clarity :P

drclaw’s picture

Ha woah that's a neat idea actually. That's not really what I was suggesting here, but I like it...

What I'm suggesting here is that if a file named file.txt has been uploaded on Node 1, you probably don't want a file with the same name uploaded to Node 9999 to overwrite it. So my suggestion is that we only overwrite files that are currently attached to the same node/field you're uploading to.