fix: admin/fs: inconsistency when adding /
Massimo Melina committed
Mar 29, 2023 at 23:14 UTC
599c6985c1ea6cfe7393a9053071f1f9d5ddaf5c
1 file changed
+2
src/api.vfs.ts
+2
@@ -106,6 +106,8 @@ const apis: ApiHandlers = {
106
return new ApiError(HTTP_NOT_ACCEPTABLE, 'invalid parent')
107
if (isWindowsDrive(source))
108
source += '\\' // slash must be included, otherwise it will refer to the cwd of that drive
109
+ else if (source === '/')
110
+ name ||= 'root'
111
n.children ||= []
112
const sameName = name && isSameFilenameAs(name)
113
if (n.children.find(x => source && source === x.source || sameName?.(x)))