Filename does not get auto-incremented when file is added from current page's files directory
Short description of the issue
When adding a file whose filename is the same as an existing file belonging to the page, the added filename is automatically incremented. In the example below I've added an image from the home page's files directory.
But when the added file is from the current page's directory the filename is not auto-incremented, and this means that there is now a single file shared between two fields.
If the file is deleted from one field the other field now contains a missing asset.
Expected behavior
Filename is always auto-incremented if it clashes with a file that already exists, regardless of the path of the added file.
Setup/Environment
- ProcessWire version: 3.0.233
@Toutouwai PW determines whether to copy a file into its files directory based on whether it already exists in its directory or not. This directory is managed by PW and is not designed for something else copying stuff into it. I guess I think if something external is placing files into a PW managed directory then that's probably okay, but that tool would need to take care not to set these kinds of traps. Though if you don't see a way to avoid it, let me know and perhaps we can come up with something.
This directory is managed by PW and is not designed for something else copying stuff into it.
The file isn't necessarily copied in by something other than PW. Here's another way of producing the same problem as described in the first post:
This seems like valid usage of the API and not something that should create a problem.