Skip to content

[5.x]: GraphQL: includeSubfolders has no effect in asset query #17023

@eirabben

Description

@eirabben

What happened?

Description

The includeSubfolders parameter in GraphQL does not seem to work when querying assets.

The description of the parameter: Broadens the query results to include assets from any of the subfolders of the folder specified by folderId.

I discovered this on a project I was working on, and confirmed it in a freshly created project.

Steps to reproduce

  1. Install Craft CMS
  2. Add asset filesystem and volume
  3. Make some nested folders, and upload assets
  4. Setup a GraphQL query:
query MyQuery {
  assets(volume: "images", folderId: "4", includeSubfolders: true) {
    ... on images_Asset {
      id
      title
    }
  }
}

Expected behavior

This query should return all the assets in the folder with id 4, as well as assets in any subfolders.

Actual behavior

Only the assets in the folder with id 4 are returned.

Craft CMS version

5.6.14

PHP version

8.3

Operating system and version

No response

Database type and version

mysql 8.0

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions