U4-10493 - RTE hyperlink tool doesn't link to media selected through a search

Created by Brian Powell 03 Oct 2017, 18:29:28 Updated by Sebastiaan Janssen 12 Jul 2018, 10:37:44

Tags: PR

Relates to: U4-4732

I'm trying to create a hyperlink in my webpage to an uploaded media file. In the RTE, if I go to Hyperlink -> Select Media, I can drill down to the media folder that contains the item I want to click to. When I click the Submit button, the URL of the file I selected populates the Link box and if I click Submit again, the link gets created.

In 7.7+, I can search all folders for media. If I search for a file and then choose one of the resulting files, it's URL does not populate the Link textbox. The link is never created. This needs fixed so the link URL is grabbed whether you're searching for a media file or manually browsing for it.

Comments

Gerty Engrie 10 Oct 2017, 08:07:37

Same issue on 7.6.8. When browsing for a media item all goes well but when searching in the dialog for the media item the link displays "Url" instead of the real url. Not only in RTE but also in contentpickers.


Benjamin Stengaard 31 Oct 2017, 07:46:20

I have exactly the same problem in version 7.7.2 and 7.6.2


Rune Antonsen 02 Feb 2018, 15:19:48

It's due to that the searchMedia function only adds umbracoHeight and umbracoWidth ([SEE HERE|https://github.com/umbraco/Umbraco-CMS/blob/e333f6c6280b6221b777c22a0ed80995608e3ffd/src/Umbraco.Web.UI.Client/src/views/common/overlays/mediaPicker/mediapicker.controller.js#L324])

If you follow the breadcrumbs back out to the return function of the linkpicker dialog you can see what it want's to do: $scope.model.target.url = mediaHelper.resolveFile(media); ([LINK|https://github.com/umbraco/Umbraco-CMS/blob/e0025db56d52b770d2b3aedbd48a3b804fd15ef0/src/Umbraco.Web.UI.Client/src/views/common/overlays/linkpicker/linkpicker.controller.js#L104])

And if you check out the mediaHelper.resolveFile function it tries to get the path to use from any registered _mediaFileResolvers

The only two I found in the code is: Umbraco.ImageCropper([LINK|https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js#L120]) and Umbraco.UploadField([LINK|https://github.com/umbraco/Umbraco-CMS/blob/c09cd95eb6a9faa587f81afb79d543652c3f48bd/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js#L161])

But since the searchMedia doesn't give a crap about mapping up these two properties no URL is returned.


Rune Antonsen 02 Feb 2018, 15:28:19

U4-9793 U4-10153 U4-10042


Rune Antonsen 02 Feb 2018, 15:30:59

@madsrasmussen


Rune Antonsen 02 Feb 2018, 15:37:20

https://our.umbraco.org/forum/using-umbraco-and-getting-started/87936-linking-to-media-not-returning-url-when-providing-a-search-term


Eric Schrepel 14 Feb 2018, 22:55:06

Yep, and related issue, sometimes when you start to type a search term in the media box, it very briefly shows the item you were seeking, then that item (and search term) disappear and you have to enter it a second time. But still, once you select the item you were searching for, doesn't complete the Link URL field.


Gijs Maris 06 Apr 2018, 11:53:56

This issue still persists in 7.10.0.


Nathan Woulfe 20 Jun 2018, 21:19:28

Haven't looked into why/how, but my PR for restoring anchors in the linkpicker seems to have fixed this too.

My changes include fetching the URL using contentResource.getById() rather than .getNiceUrl() as I needed access to other properties, so this might have been the fix.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.7.1, 7.6.8, 7.7.2, 7.7.7, 7.10.0, 7.9.2, 7.10.4

Due in version: 7.12.0

Sprint:

Story Points:

Cycle: