Skip to content

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

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

Closed
eirabben opened this issue Apr 3, 2025 · 2 comments
Closed

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

eirabben opened this issue Apr 3, 2025 · 2 comments
Labels

Comments

@eirabben
Copy link

eirabben commented Apr 3, 2025

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

@eirabben eirabben added the bug label Apr 3, 2025
@eirabben eirabben changed the title [5.x]: GraphQL: includeSubfolders has no effect [5.x]: GraphQL: includeSubfolders has no effect in asset query Apr 3, 2025
@brandonkelly
Copy link
Member

Thanks for reporting that! Fixed for the next Craft 4 and 5 releases.

@brandonkelly
Copy link
Member

Craft 4.14.13 and 5.6.15 are out with that fix.

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

No branches or pull requests

2 participants