From d5993a478342e691fc99f5640b2c17bf55dd24ab Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 10 Jul 2014 12:09:26 +1000 Subject: [PATCH 1/5] Backports fix from 7 for GetDimensions call to ensure the file exists --- src/Umbraco.Core/IO/UmbracoMediaFile.cs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Core/IO/UmbracoMediaFile.cs b/src/Umbraco.Core/IO/UmbracoMediaFile.cs index 2c8021388a..7d91dd0176 100644 --- a/src/Umbraco.Core/IO/UmbracoMediaFile.cs +++ b/src/Umbraco.Core/IO/UmbracoMediaFile.cs @@ -133,14 +133,22 @@ namespace Umbraco.Core.IO { if (_size == null) { - EnsureFileSupportsResizing(); - - using (var fs = _fs.OpenFile(Path)) - using (var image = Image.FromStream(fs)) + if (_fs.FileExists(Path)) { - var fileWidth = image.Width; - var fileHeight = image.Height; - _size = new Size(fileWidth, fileHeight); + EnsureFileSupportsResizing(); + + using (var fs = _fs.OpenFile(Path)) + using (var image = Image.FromStream(fs)) + { + + var fileWidth = image.Width; + var fileHeight = image.Height; + _size = new Size(fileWidth, fileHeight); + } + } + else + { + _size = new Size(-1, -1); } } return _size.Value; From 6b128ea7d4b838cc01307bf71d9fc7618c403f35 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 10 Jul 2014 17:29:34 +1000 Subject: [PATCH 2/5] Fixes: U4-5208 RenderActionInvoker needs to be able to run async so needs to inherit from AsyncControllerActionInvoker --- src/Umbraco.Web/Mvc/RenderActionInvoker.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Mvc/RenderActionInvoker.cs b/src/Umbraco.Web/Mvc/RenderActionInvoker.cs index f4efc6a570..e01268d245 100644 --- a/src/Umbraco.Web/Mvc/RenderActionInvoker.cs +++ b/src/Umbraco.Web/Mvc/RenderActionInvoker.cs @@ -1,12 +1,13 @@ using System.Linq; using System.Web.Mvc; +using System.Web.Mvc.Async; namespace Umbraco.Web.Mvc { /// /// Ensures that if an action for the Template name is not explicitly defined by a user, that the 'Index' action will execute /// - public class RenderActionInvoker : ControllerActionInvoker + public class RenderActionInvoker : AsyncControllerActionInvoker { /// From 6167d1584ab76cdd782529e2ed7a8a50a46abb4c Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 15 Jul 2014 11:37:31 +1000 Subject: [PATCH 3/5] Fixes an xss vulnerability --- .../umbraco/developer/Packages/proxy.htm | 54 +++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/developer/Packages/proxy.htm b/src/Umbraco.Web.UI/umbraco/developer/Packages/proxy.htm index 4d89a2c063..b65ea2d674 100644 --- a/src/Umbraco.Web.UI/umbraco/developer/Packages/proxy.htm +++ b/src/Umbraco.Web.UI/umbraco/developer/Packages/proxy.htm @@ -5,9 +5,57 @@ - + From 388eea95e51069ac46a090f32878ee3c3630a9f7 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 16 Jul 2014 13:46:15 +1000 Subject: [PATCH 4/5] fixes a single vs first check with render route handler when there might be duplicate routes assigned to a controller, fixes short/int parse --- .../Persistence/Factories/ServerRegistrationFactory.cs | 2 +- src/Umbraco.Web/Mvc/RenderRouteHandler.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Persistence/Factories/ServerRegistrationFactory.cs b/src/Umbraco.Core/Persistence/Factories/ServerRegistrationFactory.cs index fc065102e0..790106dbee 100644 --- a/src/Umbraco.Core/Persistence/Factories/ServerRegistrationFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/ServerRegistrationFactory.cs @@ -29,7 +29,7 @@ namespace Umbraco.Core.Persistence.Factories ComputerName = entity.ComputerName }; if (entity.HasIdentity) - dto.Id = short.Parse(entity.Id.ToString(CultureInfo.InvariantCulture)); + dto.Id = int.Parse(entity.Id.ToString(CultureInfo.InvariantCulture)); return dto; } diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index 04ae377027..0d0e012f1a 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -228,8 +228,9 @@ namespace Umbraco.Web.Mvc // If more than one route is found, find one with a matching action if (surfaceRoutes.Count() > 1) { - surfaceRoute = surfaceRoutes.SingleOrDefault(x => - x.Defaults["action"].ToString().InvariantEquals(postedInfo.ActionName)); + surfaceRoute = surfaceRoutes.FirstOrDefault(x => + x.Defaults["action"] != null && + x.Defaults["action"].ToString().InvariantEquals(postedInfo.ActionName)); } else { From 7848a3095d2df87975382832f341a60baeeeb0cb Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 16 Jul 2014 14:12:04 +1000 Subject: [PATCH 5/5] Fixes: U4-5207 User Type with a space in the name breaks User Content --- .../Models/Membership/UserType.cs | 57 ++++++++++++++++--- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Core/Models/Membership/UserType.cs b/src/Umbraco.Core/Models/Membership/UserType.cs index b5553c10d2..915943be43 100644 --- a/src/Umbraco.Core/Models/Membership/UserType.cs +++ b/src/Umbraco.Core/Models/Membership/UserType.cs @@ -1,27 +1,55 @@ using System; using System.Collections.Generic; +using System.Reflection; using System.Runtime.Serialization; using Umbraco.Core.Models.EntityBase; using Umbraco.Core.Persistence.Mappers; +using Umbraco.Core.Strings; namespace Umbraco.Core.Models.Membership { /// /// Represents the Type for a Backoffice User - /// - /// - /// Should be internal until a proper user/membership implementation - /// is part of the roadmap. - /// + /// [Serializable] [DataContract(IsReference = true)] internal class UserType : Entity, IUserType { - [DataMember] - public string Alias { get; set; } + private string _alias; + private string _name; + private IEnumerable _permissions; + + private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo(x => x.Name); + private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo(x => x.Alias); + private static readonly PropertyInfo PermissionsSelector = ExpressionHelper.GetPropertyInfo>(x => x.Permissions); [DataMember] - public string Name { get; set; } + public string Alias + { + get { return _alias; } + set + { + SetPropertyValueAndDetectChanges(o => + { + _alias = value.ToCleanString(CleanStringType.Alias | CleanStringType.UmbracoCase); + return _alias; + }, _alias, AliasSelector); + } + } + + [DataMember] + public string Name + { + get { return _name; } + set + { + SetPropertyValueAndDetectChanges(o => + { + _name = value; + return _name; + }, _name, NameSelector); + } + } /// /// The set of default permissions for the user type @@ -30,6 +58,17 @@ namespace Umbraco.Core.Models.Membership /// By default each permission is simply a single char but we've made this an enumerable{string} to support a more flexible permissions structure in the future. /// [DataMember] - public IEnumerable Permissions { get; set; } + public IEnumerable Permissions + { + get { return _permissions; } + set + { + SetPropertyValueAndDetectChanges(o => + { + _permissions = value; + return _permissions; + }, _permissions, PermissionsSelector); + } + } } } \ No newline at end of file