Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Content Editor Discussions /

Forum for content editors and CMS users.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Terms for replacing files are ambiguous, leading to incorrect replacements

Go to End

2 Posts   400 Views


Community Member, 3 Posts

13 December 2016 at 3:23pm

Edited: 13/12/2016 4:08pm

Assume SilverStripe 3 (I'm not sure it matters which point version).

If you want to replace a file ("Files" tab, for /assets/ directory), you go to the "Files" tab, locate the file, click the edit icon, select the "Replace" tab, and replace it that way.

BUT, if you don't do this often and haven't noticed/remembered the "Replace" tab, it's not unreasonable to try loading a new copy of the file. That wouldn't be a problem if the error message you got for a clash of filenames was more helpful, but what you see is "File with the same name already exists" followed by a logo-with-text saying "Overwrite".

It's not unreasonable to assume that "Overwrite" means you'll overwrite the file with the same name. That's not what happens. Instead, the file is saved as filename-2, and the original file is still there at filename.

I'd like to replace "Overwrite" in the text above with something like "Save anyway" - possibly with a note that the filename will have a number added. Anything to make it clear to an occasional content loader that the successful overwrite they did didn't actually change the original file in any way.

Thoughts? Are we the only people who've run into this? :)


Forum Moderator, 1391 Posts

14 December 2016 at 6:38am

Edited: 14/12/2016 6:41am

Looks like version dóes actually matter. I tried this in 3.1.5 and it responds with the warning, like in your case, but it then doesn't go and create a new file anyway

Then I tried in 3.4 and that just creates the second file without any warning, which to me is more logical anyway (what would replacing a file do with resized images that were already created?)

In both cases I can't actually find a replace tab. There is a setting in framework/_config/config.yml that you could experiment with (if your version supports it), by copying it to mysite/_config/config.yml (and flushing):

  # Replace an existing file rather than renaming the new one.
  replaceFile: false

[EDIT] And/or, if possible, upgrade :)