fix: couldn't upload a file without extension if the same name already exists and dont_overwrite_uploading is enabled
Massimo Melina committed
May 21, 2024 at 18:51 UTC
46d9deb5d68fedb254c23fae81f86c56be0c2912
1 file changed
+1
-1
src/upload.ts
+1
-1
@@ -111,7 +111,7 @@ export function uploadWriter(base: VfsNode, path: string, ctx: Koa.Context) {
111
let dest = fullPath
112
if (dontOverwriteUploading.get() && fs.existsSync(dest) && !await overwriteAnyway()) {
113
const ext = extname(dest)
114
- const base = dest.slice(0, -ext.length)
114
+ const base = dest.slice(0, -ext.length || Infinity)
115
let i = 1
116
do dest = `${base} (${i++})${ext}`
117
while (fs.existsSync(dest))