From 922942197ff140f351c3f2d1bfc45deee1f69c0a Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 14 May 2014 19:57:40 +1000 Subject: [PATCH] Fixes: U4-4741 Tags Property Editor Mishandles Tags with Commas --- .../Persistence/Repositories/TagsRepository.cs | 5 ++++- .../src/views/propertyeditors/tags/tags.controller.js | 2 ++ .../src/views/propertyeditors/tags/tags.html | 7 +++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Persistence/Repositories/TagsRepository.cs b/src/Umbraco.Core/Persistence/Repositories/TagsRepository.cs index 030742b90e..7525661b66 100644 --- a/src/Umbraco.Core/Persistence/Repositories/TagsRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/TagsRepository.cs @@ -442,7 +442,10 @@ namespace Umbraco.Core.Persistence.Repositories var array = tagsToInsert .Select(tag => string.Format("select '{0}' as Tag, '{1}' as [Group]", - PetaPocoExtensions.EscapeAtSymbols(tag.Text.Replace("'", "''")), + PetaPocoExtensions.EscapeAtSymbols( + tag.Text + .Replace("'", "''") //NOTE: I'm not sure about this apostrophe replacement but it's been like that for a long time + .Replace(",", ",")), //NOTE: We need to replace commas with html encoded ones: http://issues.umbraco.org/issue/U4-4741 tag.Group)) .ToArray(); return "(" + string.Join(" union ", array).Replace(" ", " ") + ") as TagSet"; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/tags/tags.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/tags/tags.controller.js index b44712f8dc..bc6357e2b8 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/tags/tags.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/tags/tags.controller.js @@ -19,6 +19,8 @@ angular.module("umbraco") function addTag(tagToAdd) { if (tagToAdd.length > 0) { if ($scope.currentTags.indexOf(tagToAdd) < 0) { + //we need to html encode any tag containing commas: http://issues.umbraco.org/issue/U4-4741 + tagToAdd = tagToAdd.replace(",", ","); $scope.currentTags.push(tagToAdd); } } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/tags/tags.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/tags/tags.html index db13aa49cd..e0f46727ac 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/tags/tags.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/tags/tags.html @@ -1,11 +1,14 @@
- +
Loading...
- {{tag}} + + + +