fix: admin/fs: couldn't add from disk #155

Massimo Melina committed Mar 14, 2023 at 12:55 UTC f25122da97fececf4d83accee63741a6927bcaab
1 file changed +2 -2
src/api.vfs.ts
+2 -2
@@ -108,8 +108,8 @@ const apis: ApiHandlers = {
108 if (isWindowsDrive(source))
109 source += '\\' // slash must be included, otherwise it will refer to the cwd of that drive
110 n.children ||= []
111 - const sameName = isSameFilenameAs(name)
112 - if (n.children.find(x => source && source === x.source || sameName(x)))
111 + const sameName = name && isSameFilenameAs(name)
112 + if (n.children.find(x => source && source === x.source || sameName?.(x)))
113 return new ApiError(HTTP_CONFLICT, 'already present')
114 n.children.unshift({ source, name })
115 await saveVfs()