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

@ -163,6 +163,17 @@ module.exports = class FSNodeContext {
return ! this.entry.parent_uid; 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 = {}) { async exists (fetch_options = {}) {
await this.fetchEntry(); await this.fetchEntry();
if ( ! this.found ) { if ( ! this.found ) {

View File

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