Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dot character in document identifier leads to null value in dereferenced array #105

Open
Michael-1 opened this issue May 8, 2023 · 1 comment

Comments

@Michael-1
Copy link

I believe I have found a bug with referencing documents that contain the dot character (.) in their identifier.

Let’s say a have document campaign that includes the following field specification.

{
  name: 'organisations',
  title: 'Organisations',
  type: 'array',
  of: [{type: 'reference', to: [{type: 'organisation'}]}],
}

I then query this with

*[ _id == "example-campaign"] {
  organisations[] -> {
    _id,
    name
  }
}[0]

and get null entries for all organisations that have a dot character in their _id.

However, if I pass an authorisation token with the request, then the bug is not reproducible. I then also get those organisations that contain a dot in their identifier. (All involved documents are published, so I wouldn’t expect a different behaviour.)

@Michael-1
Copy link
Author

I’ve meanwhile come a cross the following statement in Sanity’s documentation of identifiers:

The default, fixed access control rules give unauthenticated users read access to documents under the root path only, which means that it is not possible to make documents under a sub-path (i.e. containing a . in the ID) publicly available.

So, this seems to be by design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant