Open tegefaulkes opened 8 months ago
The 2nd option still rubs me wrong. It's too easy to have weird edge cases. For example say we have the following.
vault
vaultOther
vault
.Can we not end up with the naming conflict resolved as vaultOther-copy
?
If you clone a vault vault
and vault
already exists, then you'd get vault-copy
. If there was a vault-copy
then it would be vault-copy-copy
. I'm looking at something similar to Windows Explorer/Dropbox when they resolved this problem, we can just copy them.
Specification
Currently this is handled very simply where we take the existing name and increment the number on it as
vaultname-1
vaultname-2
etc etc. It does this until the name doesn't already exists and uses that for the name. Otherwise it hits 50 attempts and throws. The problem with this is that the hard coded limit is not ideal.In my mind there are two alternatives. When cloning a vault and there is a name conflict it will just fail. You can specify a new name and if that conflicts it will also fail. It's pretty simple and gives the user the ability to specify the desired name.
Alternatively since the names are indexed, if the name is taken we can reverse iterate once using that name as the starting position. Then take that and append
-copy
to it.Additional context
Related: #652
Tasks