Conversation
…ia picker components, re-allowing folder selection from a media picker.
There was a problem hiding this comment.
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
folderFilterfromFILES_ONLYtoFILES_AND_FOLDERSin 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. |
|
@AndyButland I've pushed a tiny update to avoid a hardcoded enum value.
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. |
|
Sorry, that wasn't super-clear:
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.). |
kjac
left a comment
There was a problem hiding this comment.
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.
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
folderFilterparameter (filesOnly,foldersOnly,filesAndFolders) to the media picker's pickable filter, defaulting tofilesOnly. This default was applied globally — including to developer-configured media pickers whereallowedContentTypesshould be the sole control over what is selectable. Because the folder filter ran before theallowedContentTypescheck, 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
folderFilteris nowfilesAndFolders, meaning all media types are pickable by default. TheallowedContentTypesconfiguration (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
folderFiltervalue and this determines whether files, folders or both can be selected.Testing