Copied to clipboard

Flag this post as spam?

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


  • Marty Patches 6 posts 85 karma points
    Sep 26, 2016 @ 16:57
    Marty Patches
    0

    Populate DialogService with media file

    Hello,

    I'm tying to populate the linkPicker dialog with a chosen media object. I get the error:

    Request error: The URL returned a 404 (not found): /umbraco/backoffice/UmbracoApi/Entity/GetPath

    The request:

    http://www.mini.se/umbraco/backoffice/UmbracoApi/Entity/GetPath?id=2839&type=Document

    It works on pages but not on media. The ID of the media node is correct. Should it really have the parameter type=Document? Or am I supposed to use another dialogService?

    var mediaObject = { id:2457, isMedia: true, name: "logo.png", url: "/media/1008/logo.png"};
    dialogService.linkPicker(mediaObject);
    

    This is what is opens when I'm trying to open a media object. The dialog window

  • Marty Patches 6 posts 85 karma points
    Feb 20, 2017 @ 14:49
    Marty Patches
    0

    Once again I ran in to the same problem. It appeared to be a bug but I'm unable to report it.

    Although I found a solution:

    https://github.com/umbraco/Umbraco-CMS/blob/master-v7/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.controller.js#L25

    On line 25 you have this code:

    if ($scope.target.id) {
    

    Replace it with:

    if ($scope.target.id && !$scope.target.isMedia) {
    

    The only problem is that the file that's chosen is not getting preselected. It seems like it built to do that, but it just doesn't work.

    For now it's fine for me. At least the use can chose the file without getting any errors.

    If someone is able to report this bug, or even fix it, that would be great.

Please Sign in or register to post replies

Write your reply to:

Draft