Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • lori ryan 239 posts 573 karma points
    Mar 30, 2021 @ 21:00
    lori ryan
    0

    block list editor No argument found for the current action with the name: id

    Ive created a block list editor

    I keep getting the following when I open it

    No argument found for the current action with the name: id

    Exception Details System.InvalidOperationException: No argument found for the current action with the name: id

    at

    Umbraco.Web.WebApi.Filters.EnsureUserPermissionForMediaAttribute.OnActionExecuting(HttpActionContext actionContext) in D:\a\1\s\src\Umbraco.Web\WebApi\Filters\EnsureUserPermissionForMediaAttribute.cs:line 112
       at System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutingAsync(HttpActionContext actionContext, CancellationToken cancellationToken)
    --- End of stack trace from previous location where exception was thrown ---
    
  • Marc Goodson 2138 posts 14321 karma points MVP 8x c-trib
    Mar 31, 2021 @ 07:45
    Marc Goodson
    1

    Hi Lori

    At what point is this mysterious error thrown?

    Eg opening a content item that has the Block List Editor on

    or when opening the Block List Editor to choose a block

    or are you rendering the blocks 'inline' like Nested Content

    or is it displayed when you choose a type of block and are about to enter data?

    Does the ElementType that describes your Block List Editor block contain a Media Picker?

    and if so does that Media Picker have a configured 'start node'?

    The error looks like a bug - it's basically not able to get the id of a media item in order to check whether the current user has permissions to view/pick it... but that seems bizarre, and so the answers to the above may give a clue as to where to start looking

    regards

    marc

  • lori ryan 239 posts 573 karma points
    Mar 31, 2021 @ 08:15
    lori ryan
    0

    Hi Mark Literally, go to add the block to the block list it throws this error. The block contains two media pickers, two textboxes nothing overly major. It renders fine other than this error popping up.

    I try add a start node to the media picker

    Live editing mode is enabled.

  • lori ryan 239 posts 573 karma points
    Mar 31, 2021 @ 11:37
    lori ryan
    0

    When the images are set doesnt seem to happen

  • Marc Goodson 2138 posts 14321 karma points MVP 8x c-trib
    Apr 01, 2021 @ 16:55
    Marc Goodson
    0

    Hi Lori

    Yes, so it seems when an image is not set, there is a check being requested to see if the current user has access to that image 'or not'.

    I've just installed a fresh copy of Umbraco 8.12.2

    And set up your scenario, just to see if I can see something going wrong.

    But I can't make it happen.

    But I am logged in as an Admin, and don't have any start node restrictions - what is your scenario?

    Also which version of Umbraco are you using?

    Also did you update the Element Type, after creating some of the blocks initially? - eg does deleting all the blocks, saving, and reloading the backoffice page, mean that new blocks do not trigger the issue..

    Finally, do you have a custom view with the block? and is that trying to get the image back from the picker, and so is trying to do so when an image isn't picked?

    regards

    marc

  • lori ryan 239 posts 573 karma points
    Apr 06, 2021 @ 10:43
    lori ryan
    0

    Hi I am logged in as an admin. Using Umbrao version 8.11.1

    Followed the https://our.umbraco.com/documentation/getting-started/backoffice/property-editors/built-in-property-editors/Block-List-Editor/

    Have just created a brand new block but the issue remains. I actually moved the images out to the settings - as this is possible a better location for them long term. I do a null check in the controller.

    I do have a custom view.

    My Controller

     $scope.fontColor = $scope.block.settingsData.fontColor
    
        if ($scope.block.settingsData.image != null) {
            mediaResource.getById($scope.block.settingsData.image)
                .then(function (media) {
                    $scope.imageUrl = media.mediaLink;
                });
        }
    
        if ($scope.block.settingsData.backgroundImage != null) {
            mediaResource.getById($scope.block.settingsData.backgroundImage)
                .then(function (media) {
                    $scope.bgImageUrl = media.mediaLink;
                });
        }
    
        if ($scope.block.settingsData.curve != null) {
            mediaResource.getById($scope.block.settingsData.curve)
                .then(function (media) {
                    $scope.CurveImageUrl = media.mediaLink;
                });
        }
    

    My View

    <div ng-controller="headerNewController" ng-click="block.edit()">
    
    
    
    
        <table cellpadding="4">
            <tr>
                <td style="width:50%; background-image:url('{{bgImageUrl}}'); background-size:cover; background-repeat:no-repeat;">
                    <h2 ng-bind="block.data.title"></h2>
                    <p ng-bind-html="block.data.paragraph" style="color:{{fontColor}}"></p>
                </td>     
                <td style="width:50%; background-image:url('{{imageUrl}}'); background-size:cover; background-repeat:no-repeat;">
                    &nbsp;
                </td>
            </tr>
        </table>
    
    
    
    
    
    
    
    
    </div>
    
  • Marc Goodson 2138 posts 14321 karma points MVP 8x c-trib
    Apr 06, 2021 @ 11:57
    Marc Goodson
    1

    Hi Lori

    Ahh, I think that makes more sense, I think it's the getById of the MediaResource that will trigger the check to see if the current user has permissions to access that id. (you could comment it out temporarily to confirm)

    My guess here is that perhaps $scope.block.settingsData.backgroundImage isn't null, but is instead 0 or an empty string ? when an image isn't picked?

    You could use console.log() to see what the value is when the null check is being made, I did something recently in a custom block list editor view for a content picker:

    http://tooorangey.co.uk/posts/editing-some-tabular-data-in-umbraco-v8/

    and it looks like I ended up checking the 'length' of the value rather than trying to detect if it was null...

    eg

    if ($scope.block.settingsData.image.length > 0) {
    

    so that might be worth a shout...

    regards

    Marc

  • lori ryan 239 posts 573 karma points
    Apr 06, 2021 @ 12:43
    lori ryan
    0

    Marc thank you so much for sticking with me - that was it

    scope.block.settingsData.backgroundImage.length > 0

    rather than null

  • Marc Goodson 2138 posts 14321 karma points MVP 8x c-trib
    Apr 07, 2021 @ 06:31
    Marc Goodson
    1

    Hurray!

Please Sign in or register to post replies

Write your reply to:

Draft