rasmusjp / umbraco-multi-url-picker

Multi Url Picker for Umbraco 7
MIT License
31 stars 29 forks source link

Editing a media item breaks the link #48

Closed Myster closed 7 years ago

Myster commented 8 years ago

Given I have media with ID 3 and path of "/media/123/maidenname.docx" Given I have picked media item 3. Given I replace the file of media ID 3 I get a path of "/media/124/marriedname.docx" When I edit the place where item 3 was picked, and click 'select' again Then the link becomes an external link, and the URL used is "/media/123/maidenname.docx"

Note: If I do not edit/save this picked item then the link remains unbroken since it determines the url from media ID 3 at run-time.

I consider this a somewhat rare corner case, but it should be noted.

Aside: I have a thumbnail upload for media of type file... in this case the "Link to document" field shows the thumbnail URL, but the correct URL is shown to the user... in this case when the record is edited and 'select' is clicked without re-picking the media then the links now link to the thumbnail not the PDF, and it is now an 'external' link.

Note: editing the link (by opening click select) always converts it to an external link regardless of whether the media item has been modified.

dawoe commented 7 years ago

I noticed this as well. Seems to be known... when a "media" link is edited the id is not passed to the link picker dialog. It is actually as a comment in the code that will break the link picker.

https://github.com/rasmusjp/umbraco-multi-url-picker/blob/master/src/RJP.MultiUrlPicker/App_Plugins/RJP.MultiUrlPicker/MultiUrlPicker.js#L54

Will try to have a stab at it

dawoe commented 7 years ago

Created a PR for this one

rasmusjp commented 7 years ago

I've merged in the PR and release v1.3.2, should be both on our and nuget