Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a media picker folder navigation bug that caused a TypeError when users with restricted media start node permissions navigated folders while "Ignore user start nodes" was enabled on the data type.
Changes:
- Fixed parameter name mismatch in
EntityController.GetResultForAncestorsfromdataTypeIdtodataTypeKeyto match what the client sends and align with other controller methods - Added defensive null check in JavaScript
gotoFolderto prevent accessing$scope.path[0]when the filtered ancestor array is empty
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Umbraco.Web.BackOffice/Controllers/EntityController.cs | Changed query string parameter name from "dataTypeId" to "dataTypeKey" in GetResultForAncestors method to match client request and align with other endpoints in the same controller |
| src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js | Added defensive check to prevent TypeError when $scope.path is empty after filtering ancestors |
Migaroez
approved these changes
Mar 6, 2026
Contributor
Migaroez
left a comment
There was a problem hiding this comment.
Looks good and tests out as described
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#21840 reports an an issue where the media picker (egacy) threw a
TypeError: Cannot read properties of undefined (reading 'path')when navigating into folders, when the data type had "Ignore user start nodes" enabled and the user had restricted media start node permissions.The bug was a query parameter name mismatch in
EntityController.GetResultForAncestors: it read"dataTypeId"from the query string but the client sends"dataTypeKey", so the server never detected theignoreUserStartNodesconfiguration.I've also added a defensive guard in the client-side
gotoFolderto handle an empty ancestor path without throwing,Root cause
This was reported as a regression in recent versions (which is why I looked at it) but the parameter name mismatch in
EntityController.cshas existed for years — theGetResultForAncestorsmethod reads"dataTypeId"from theFormCollection, while every other endpoint in the same controller (GetChildren,GetPagedChildren,Search) correctly usesdataTypeKeyas a named action parameter. The client has always sentdataTypeKey. This meantignoreUserStartNodeswas effectively alwaysfalsefor theGetAncestorsendpoint.Why it only recently surfaced
The bug was latent until PR #20202 (released in 13.12.0) refactored
gotoFolderto properly chain its promises. Before that PR,getChildren(folder.id)was called immediately and unconditionally and not chained to the ancestor resolution promise. So even when$scope.path[0].paththrew inside the.then()callback, the error was silently swallowed and the folder's children still loaded. After #20202 correctly chainedgetChildrenafter the ancestor path resolution, the exception now rejects the promise chain and prevents the folder contents from loading.Testing
For manual testing see "Steps to reproduce" on the linked issue.