Skip to content

getResourceInfoWithAccessDatasets fails to return ACP data #2380

@pduchesne

Description

@pduchesne

Search terms you've used

getResourceInfoWithAccessDatasets

Bug description

The getResourceInfoWithAccessDatasets method in acp.ts does not return the access datasets as expected.
More specifically, when the resource is ACP-controlled and the policy URL is set in internal_resourceInfo.aclUrl (as is the case with f.i. the Inrupt PodSpaces)
In that case, the internal_fetchAcl method internally receives a AclIsAcrError, and results in null ACLs

if (e instanceof AclIsAcrError) {
return {
resourceAcl: null,
fallbackAcl: null,

However, getResourceInfoWithAccessDatasets ignores the empty ACLs or the AclIsAcrError and returns thinking it is indeed an ACL (L206), and never reaches the fetchAcr call as it should in that case.
if (hasAccessibleAcl(resourceInfo)) {
const acl = await internal_fetchAcl(resourceInfo, options);
return internal_setAcl(resourceInfo, acl);
}
const acr = await fetchAcr(resourceInfo, options);
return { ...resourceInfo, ...acr };

Expected result

Get the ACR datasets as expected when the ACP policy URL is set in internal_resourceInfo.aclUrl

Actual result

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions