Skip to content

Commit

Permalink
fix(vfs): exception falls through in mountpoint check
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Jan 9, 2024
1 parent 1e2ea98 commit f1ccfd5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/vfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,17 @@ const createOptions = req => {

// Standard request with only a target
const createRequestFactory = findMountpoint => (getter, method, readOnly, respond) => async (req, res) => {
const options = createOptions(req);
const [target, ...rest] = getter(req, res);
const [resource] = rest;

const found = await findMountpoint(target);
const attributes = found.mount.attributes || {};
const strict = attributes.strictGroups !== false;

if (method === 'search') {
if (attributes.searchable === false) {
return [];
const call = async (target, rest, options) => {
const found = await findMountpoint(target);
const attributes = found.mount.attributes || {};
const strict = attributes.strictGroups !== false;

if (method === 'search') {
if (attributes.searchable === false) {
return [];
}
}
}

const call = async () => {
await checkMountpointPermission(req, res, method, readOnly, strict)(found);

const vfsMethodWrapper = m => {
Expand Down Expand Up @@ -201,11 +197,15 @@ const createRequestFactory = findMountpoint => (getter, method, readOnly, respon
};

return new Promise((resolve, reject) => {
const options = createOptions(req);
const [target, ...rest] = getter(req, res);
const [resource] = rest;

if (resource instanceof Stream) {
resource.once('error', reject);
}

call().then(resolve).catch(reject);
call(target, rest, options).then(resolve).catch(reject);
});
};

Expand Down

0 comments on commit f1ccfd5

Please sign in to comment.