fix: handle subpaths under another user

This commit is contained in:
KernelDeimos 2024-06-13 15:46:27 -04:00 committed by Eric Dubé
parent 19a5eb0076
commit d128ceed6f
2 changed files with 12 additions and 2 deletions

View File

@ -162,6 +162,17 @@ module.exports = class FSNodeContext {
if ( this.found === false ) return undefined;
return ! this.entry.parent_uid;
}
async getUserPart () {
if ( this.isRoot ) return;
let path = await this.get('path');
if ( path.startsWith('/') ) path = path.slice(1);
const components = path.split('/');
const userpart = components[0];
return userpart;
}
async exists (fetch_options = {}) {
await this.fetchEntry();

View File

@ -53,8 +53,7 @@ class HLReadDir extends HLFilesystemOperation {
const ll_listusers = new LLListUsers();
children = await ll_listusers.run(this.values);
} else if (
await subject.isUserDirectory() &&
await subject.get('name') !== user.username
await subject.getUserPart() !== user.username
) {
this.log.noticeme('THIS HAPPEN');
const ll_readshares = new LLReadShares();