fix: adding whole drive on Windows was not always referring to its root
Massimo Melina committed
Aug 29, 2022 at 12:02 UTC
43ef3df85962bb5aa8e81dbab8eab92161ab8489
1 file changed
+2
src/api.vfs.ts
+2
@@ -77,6 +77,8 @@ const apis: ApiHandlers = {
77
return new ApiError(404, 'invalid under')
78
if (n.isTemp || !await nodeIsDirectory(n))
79
return new ApiError(FORBIDDEN, 'invalid under')
80
+ if (isWindowsDrive(source))
81
+ source += '\\' // slash must be included, otherwise it will refer to the cwd of that drive
82
const a = n.children || (n.children = [])
83
if (source && a.find(x => x.source === source))
84
return new ApiError(409, 'already present')