Skip to content

files.entries can be empty in search endpoint responses #3552

Description

@ejuet

Describe the bug

files.entries can be empty, even if the record has files.

This happens when we retrieve the record details via a search endpoint, i.e. via API endpoints /api/user/records?q=... or /api/records?q=...

This does not happen when we use the endpoints to view the records directly, e.g. /api/records/<record_id>/ or /api/records/<record_id>/draft/ and the files reliably show.

Still, files.entries should not be empty simply because we got the details from a search endpoint.

Steps to Reproduce

The two cases where files.entries can be empty when using search endpoints are:

  • the record is a draft
  • the record is restricted (= only some users are allowed to see the files)
    • It makes sense that the files are omitted if the user does not have the permission to see them, but they are always omitted when using search endpoints, even if the user is authenticated and has the right permissions.

Expected behavior

files.entries should only be empty if the authenticated user does not have the right to view them, independent of which endpoint is used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions