From 4ad73dc1833d960aa9f8081bd0bb6f578ad750b5 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Wed, 4 Mar 2020 12:50:50 +0100 Subject: [PATCH] Fix completely broken(tm) media pickers --- .../mediapicker/mediapicker.controller.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js index cde99d7b9e..340e6865ef 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js @@ -49,12 +49,10 @@ angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerControl // when there is no match for a selected id. This will ensure that the values being set on save, are the same as before. medias = ids.map(id => { - var found = medias.find(m => - // We could use coercion (two ='s) here .. but not sure if this works equally well in all browsers and - // it's prone to someone "fixing" it at some point without knowing the effects. Rather use toString() - // compares and be completely sure it works. - m.udi.toString() === id.toString() || m.id.toString() === id.toString()); - + // We could use coercion (two ='s) here .. but not sure if this works equally well in all browsers and + // it's prone to someone "fixing" it at some point without knowing the effects. Rather use toString() + // compares and be completely sure it works. + var found = medias.find(m => m.udi.toString() === id.toString() || m.id.toString() === id.toString()); if (found) { return found; } else {