Skip to content

Media Picker: Fix folder selection regression for developer-configured media pickers (closes #22349)#22350

Merged
kjac merged 2 commits intomainfrom
v17/bugfix/22349-media-picker-folder-selection
Apr 7, 2026
Merged

Media Picker: Fix folder selection regression for developer-configured media pickers (closes #22349)#22350
kjac merged 2 commits intomainfrom
v17/bugfix/22349-media-picker-folder-selection

Conversation

@AndyButland
Copy link
Copy Markdown
Contributor

@AndyButland AndyButland commented Apr 4, 2026

Description

This PR fixes a regression reported in #22349 and introduced by #21895 (which closed #21885) where a media picker configured to allow the selection of folder media types no longer permitted selection of those folder items.

What went wrong

#21895 introduced a folderFilter parameter (filesOnly, foldersOnly, filesAndFolders) to the media picker's pickable filter, defaulting to filesOnly. This default was applied globally — including to developer-configured media pickers where allowedContentTypes should be the sole control over what is selectable. Because the folder filter ran before the allowedContentTypes check, folders were rejected even when explicitly included in the allowed types configuration.

Fix

The fix separates the concerns of developer-configured vs system-use media pickers:

  • Developer-configured media pickers (e.g. the standard Media Picker property editor): The default folderFilter is now filesAndFolders, meaning all media types are pickable by default. The allowedContentTypes configuration (from the data type filter setting) is the only thing that controls which types can be selected — if a developer includes a folder type in allowed types, it will be selectable; if they don't configure any filter, everything is selectable.

  • System-use media pickers (e.g. user media start node, RTE image upload folder, package media selection, media link picker): These explicitly pass the appropriate folderFilter value and this determines whether files, folders or both can be selected.

Testing

  • Configure a media picker property editor with allowed types that include a folder media type → verify folders are selectable.
  • Configure a media picker with no type filter → verify both files and folders are selectable,
  • Verify user media start node picker allows folder selection (not files).
  • Verify create package media picker allows file and folder selection.
  • Verify multi-URL picker media selection allows file selection (not folders).
  • Verify RTE image upload folder allows folder selection (not files).
  • Verify Content Picker (formerly MNTP) works for media, both with and without explicitly configured types.

…ia picker components, re-allowing folder selection from a media picker.
Copilot AI review requested due to automatic review settings April 4, 2026 06:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression where developer-configured media pickers could no longer select folder media types by changing the default folder filtering behavior to allow both files and folders unless explicitly restricted.

Changes:

  • Changed the default folderFilter from FILES_ONLY to FILES_AND_FOLDERS in the media picker input context and element.
  • Explicitly set folder-filter="filesOnly" for the Multi-URL Picker’s media link picker to preserve “files only” behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Umbraco.Web.UI.Client/src/packages/multi-url-picker/link-picker-modal/link-picker-modal.element.ts Explicitly restricts the link picker’s media selection to files only.
src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-media/input-media.element.ts Updates the umb-input-media default folder filter to allow folders by default.
src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-media/input-media.context.ts Updates the picker context’s default filtering logic to allow folders by default.

@kjac
Copy link
Copy Markdown
Contributor

kjac commented Apr 7, 2026

@AndyButland I've pushed a tiny update to avoid a hardcoded enum value.

Verify RTE image upload folder allows folder selection (not files).

How can I trigger this test scenario? I've tried a fair few ways to trigger file creation from the RTE, but I seem to get error upon error. These errors are not related to this PR, though.

@AndyButland
Copy link
Copy Markdown
Contributor Author

Sorry, that wasn't super-clear:

Verify RTE image upload folder allows folder selection (not files).

This refers to configuration of the RTE data type. One of the configuration options is the root folder for media uploads through the RTE to be saved to. You should only be able to select a media item that is a folder here, not a media item that relates to a file type (image, article, vector image etc.).

Copy link
Copy Markdown
Contributor

@kjac kjac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as advertised 👍

In principle this is a breaking change. However, I do believe this counts as a bugfix, because if you follow the long line of issues, this has clearly never worked as intended.

@kjac kjac merged commit bfa3c32 into main Apr 7, 2026
29 checks passed
@kjac kjac deleted the v17/bugfix/22349-media-picker-folder-selection branch April 7, 2026 08:33
AndyButland added a commit that referenced this pull request Apr 7, 2026
…d media pickers (closes #22349) (#22350)

* Fixes "files/folders/files or folders" selections for the various media picker components, re-allowing folder selection from a media picker.

* Import and use enim instead of hardcoded enum value

---------

Co-authored-by: kjac <kja@umbraco.dk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V17 Unable to select a media folder as an "Image Upload Folder"

3 participants