Skip to content

Folder structure for Media #307

Open

Description

@rchlfryn

In our initial overview with SAC, it was mentioned there might be a need for adding folder structure to Media. (ie: Bios/ , BlogImages/)

Activity

  1. added theissue type on Jun 24, 2025
  2. busbyk commented on Aug 6, 2025

    @busbyk
    Collaborator

    @rustynwac -- this functionality actually just got into Payload core. We'll need to upgrade to the latest version and it's still pretty new / seems to have some minor bugs that are getting fixed.

    So we can turn this on pretty easily but I don't think it's necessary for launch but let me know if you think otherwise.

    https://payloadcms.com/docs/folders/overview

  3. added this to the Summer 2026 milestone on Aug 6, 2025
  4. andyanderso commented on Oct 4, 2025

    @andyanderso

    If it is really easy, I would love to turn this on to build the media organization structure as we load content. It seems like that will be easier than organizing all the media afterwards.

  5. busbyk commented on Oct 5, 2025

    @busbyk
    Collaborator

    If it is really easy, I would love to turn this on to build the media organization structure as we load content. It seems like that will be easier than organizing all the media afterwards.

    Seems reasonable to add this to me. I'd like to wait until #571 is merged and then we can play around with this more and see what the implications are to the UI.

  6. added
    enhancement
    needs-triage
    on Jul 6, 2026
  7. busbyk commented on Jul 6, 2026

    @busbyk
    Collaborator

    This was generated by AI during triage.

    Agent Brief

    Category: enhancement
    Summary: Enable Payload's native folder organization on the Media collection, scoped per-tenant.

    Current behavior:
    The Media collection (slug media) presents a flat, tenant-filtered list with no way to group assets into folders. Payload (currently 3.81.0) ships native folder support, but it is entirely off here — there is no top-level folders config and no folders option on any collection.

    Desired behavior:
    Editors can organize media into folders in the admin, and folders are strictly tenant-scoped — a user in one avalanche center only sees and assigns folders belonging to their own tenant. This scoping is the crux of the issue: Payload auto-creates a single global folders collection (default slug payload-folders) that has no tenant field and is not covered by the existing tenant list filter, so simply flipping the feature on would let every tenant see and reassign every other tenant's folders — a data-isolation bug that must not ship.

    Key interfaces:

    • Enable folders: true on the Media CollectionConfig.
    • Add the top-level folders config to the Payload config. Note this root config is marked experimental upstream ("may change in minor versions") — call it out in the PR. Use its collectionOverrides hook to inject the tenant relationship field, the tenant list filter, and tenant-aware RBAC access into the generated folders collection, mirroring how every other tenant-scoped collection is assembled (the repo's tenantField() + filterByTenant base-list-filter pattern; the home-grown tenancy layer, not @payloadcms/plugin-multi-tenant).
    • Add the generated folders collection's slug to the tenant deprovision hook's list of tenant-scoped collections so folders cascade-delete with their tenant (avoids SQLite FK errors on tenant deletion).
    • Schema change → generate a migration (SQLite adapter) and run pnpm generate:types.

    Acceptance criteria:

    • Media documents can be placed into and moved between folders in the admin UI.
    • A user in tenant A cannot see, select, or assign a folder created under tenant B.
    • Deleting a tenant removes its folders with no foreign-key errors.
    • A migration is generated and pnpm migrate:check passes.
    • pnpm generate:types has been run and folder types are present; pnpm seed:standalone completes.

    Out of scope:

    • Enabling folders on any collection other than Media (Documents is the obvious follow-up but is a separate issue).
    • Migrating/auto-sorting existing media into folders.
    • Any change to the public-facing frontend — this is admin-only organization.
  8. added
    ready-for-agent
    and removed
    needs-triage
    on Jul 6, 2026
  9. added 5 commits that reference this issue on Oct 20, 2026
    d505fc0
    02c3cb0
    60560b9
    5346713
    b1a5861
  10. removed this from the Start of 26/27 Season milestone on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issueready-for-agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions