fix: masks should override parent's properties
Massimo Melina committed
Feb 20, 2023 at 17:21 UTC
b920e0cd3a904dbaaa2f9e9854a180157cad6d05
1 file changed
+3
-3
src/vfs.ts
+3
-3
@@ -90,9 +90,9 @@ export async function urlToNode(url: string, ctx?: Koa.Context, parent: VfsNode=
90
original: child,
91
isTemp: true,
92
}
93
- inheritFromParent(parent, ret)
93
inheritMasks(ret, parent, name)
94
applyMasks(ret, parent, name)
95
+ inheritFromParent(parent, ret)
96
if (child) // yes
97
return urlToNode(rest, ctx, ret, getRest)
98
// not in the tree, we can see consider continuing on the disk
@@ -190,8 +190,8 @@ export async function* walkNode(parent:VfsNode, ctx?: Koa.Context, depth:number=
190
// we basename for depth>0 where we already have the rest of the path in the parent's url, and would be duplicated
191
const virtualBasename = basename(name)
192
item.isTemp = true
193
- inheritFromParent(parent, item)
193
applyMasks(item, parent, virtualBasename)
194
+ inheritFromParent(parent, item)
195
if (ctx && !hasPermission(item, 'can_see', ctx))
196
return
197
yield item
@@ -219,7 +219,7 @@ function inheritMasks(item: VfsNode, parent: VfsNode, virtualBasename:string) {
219
else if (k.startsWith(virtualBasename+'/'))
220
o[k.slice(virtualBasename.length+1)] = v
221
if (Object.keys(o).length)
222
- item.masks = o
222
+ item.masks = _.defaults(item.masks, o)
223
}
224
225
function renameUnderPath(rename:undefined | Record<string,string>, path: string) {