U4-10521 - Creating new folders from the media picker no longer works

Created by Sebastiaan Janssen 10 Oct 2017, 13:10:11 Updated by Sebastiaan Janssen 16 Oct 2017, 14:54:42

Is duplicated by: U4-10505

Is duplicated by: U4-10530

Subtask of: U4-9609

I pressed enter a few times after entering text in the folder textbox.

Sidenote: the textbox and font are not very well aligned with the text next to it, it's kinda ugly :-)

3 Attachments

Download FolderFromPicker.mp4

Comments

Mads Rasmussen 11 Oct 2017, 08:19:38

PR: https://github.com/umbraco/Umbraco-CMS/pull/2236


Sebastiaan Janssen 11 Oct 2017, 13:13:24

Well.. The fix is great and works!

However if the initial media folder is not the root (-1) then we get a startNodeId instead, the startNodeId is always a Udi. When sending a Udi as the parentId property to MediaController.PostAddFolder, it then goes through MediaController.CheckPermissions and ends up throwing a 404 (line 918) because it can't find the id 0. I assume it's using the default value for int because the input is expected to be int, but it's a Udi instead so it can't be mapped.

So.. Steps to repro:

  • Add media picker to a doctype where the start node is the root
  • Click the picker and then the little + to create a new folder - that should work great (and if you inspect the PostAddFolder call you'll see it sends the new folder name and -1 as the parentId)
  • Reconfigure the media picker to have that new folder as a start node
  • Go back to the content item, notice that when opening the media picker you're now in the correct startNode
  • Try to create a new folder, this will now fail (see screenshot)
  • Notice that we're posting the new folder name and a Udi as startNode instead of an int as startNode - which is the problem.


Shannon Deminick 12 Oct 2017, 06:12:46

I've pushed the fix for that - the changes that were made to support UDIs for this controller were never done for this method. I've cleaned up both PostAddFile and PostAddFolder to share the common logic for parsing out the INT parent id and validating the permissions. The PostAddFolder had a silly EntityBasic parameter which wasn't required since only 2 parameters are actually passed to the method and the EntityBasic didn't support passing a string as a parentId.


Sebastiaan Janssen 12 Oct 2017, 07:26:37

Much better, it all works now! Except.. Sorry :-) When you have a start node set, the breadcrumb does not show at the top, you can make layers of new folders but the breadcrump is empty making it very hard to see what you're doing and where. See screenshot, this file is 2 folders deep under the start node.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.7.1, 7.6.8, 7.7.2

Due in version: 7.7.3, 7.6.10

Sprint: Sprint 70

Story Points: 1

Cycle: 5