diff options
author | Ido Green <igreen@netflix.com> | 2018-10-02 10:59:42 -0700 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-11-19 13:57:17 +0100 |
commit | 48d74482c1053a9531ce037207d8e5b9eab09583 (patch) | |
tree | 77ffc20ffedc31b44431f40c5fd1409b1f2ad265 | |
parent | c320f48599798db59fadcd494f337288e7523aa5 (diff) | |
download | nextcloud-server-48d74482c1053a9531ce037207d8e5b9eab09583.tar.gz nextcloud-server-48d74482c1053a9531ce037207d8e5b9eab09583.zip |
Use the new naming per the comments on #9931
More details here: https://github.com/nextcloud/server/issues/9931#issuecomment-402318120
Signed-off-by: Ido Green <greenido@gmail.com>
-rw-r--r-- | apps/files/js/filelist.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 7467cf002f2..43909fc3942 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -2292,28 +2292,28 @@ let fileNumber = leftPartOfName.match(/\d+/); if (isNaN(fileNumber) ) { fileNumber++; - targetPathAndName = targetPathAndName.replace(/(?=\.[^.]+$)/g, "_" + fileNumber); + targetPathAndName = targetPathAndName.replace(/(?=\.[^.]+$)/g, " (copy " + fileNumber + ")"); } else { // check if we have other files with _x and the same name let maxNum = 1; if (self.files !== null) { leftPartOfName = leftPartOfName.replace("/", ""); - leftPartOfName = leftPartOfName.replace(/_\d+/,""); + leftPartOfName = leftPartOfName.replace(/\(copy \d+\)/,""); // find the last file with the number extention and add one to the new name for (let j = 0; j < self.files.length; j++) { const cName = self.files[j].name; if (cName.indexOf(leftPartOfName) > -1) { - let cFileNumber = cName.match(/_(\d+)/); + let cFileNumber = cName.match(/\(copy (\d+)\)/); if (cFileNumber && parseInt(cFileNumber[1]) >= maxNum) { maxNum = parseInt(cFileNumber[1]) + 1; } } } - targetPathAndName = targetPathAndName.replace(/_\d+/,""); + targetPathAndName = targetPathAndName.replace(/ \(copy \d+\)/,""); } // Create the new file name with _x at the end - targetPathAndName = targetPathAndName.replace(/(?=\.[^.]+$)/g, "_" + maxNum); + targetPathAndName = targetPathAndName.replace(/(?=\.[^.]+$)/g, " (copy " + maxNum +")"); } } } |