diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs
index edea2821ff..81dc5d8722 100644
--- a/src/Umbraco.Web/Editors/EntityController.cs
+++ b/src/Umbraco.Web/Editors/EntityController.cs
@@ -329,13 +329,15 @@ namespace Umbraco.Web.Editors
}
///
- /// Get entities by string ids - will try to convert to the correct id type (int, guid, udi)
+ /// Get entities by UDIs
///
- ///
+ ///
+ /// A list of UDIs to lookup items by, all UDIs must be of the same UDI type!
+ ///
///
///
///
- /// We allow for POST because there could be quite a lot of Ids
+ /// We allow for POST because there could be quite a lot of Ids.
///
[HttpGet]
[HttpPost]
@@ -357,7 +359,7 @@ namespace Umbraco.Web.Editors
var guidUdi = ids[0] as GuidUdi;
if (guidUdi != null)
{
- return GetResultForKeys(ids.Select(x => ((GuidUdi)x).Guid), type);
+ return GetResultForKeys(ids.Select(x => ((GuidUdi)x).Guid).ToArray(), type);
}
throw new HttpResponseException(HttpStatusCode.NotFound);
@@ -759,21 +761,21 @@ namespace Umbraco.Web.Editors
}
}
- private IEnumerable GetResultForKeys(IEnumerable keys, UmbracoEntityTypes entityType)
+ private IEnumerable GetResultForKeys(Guid[] keys, UmbracoEntityTypes entityType)
{
- var keysArray = keys.ToArray();
- if (keysArray.Any() == false) return Enumerable.Empty();
+ if (keys.Length == 0)
+ return Enumerable.Empty();
var objectType = ConvertToObjectType(entityType);
if (objectType.HasValue)
{
- var entities = Services.EntityService.GetAll(objectType.Value, keysArray)
+ var entities = Services.EntityService.GetAll(objectType.Value, keys)
.WhereNotNull()
.Select(Mapper.Map);
// entities are in "some" order, put them back in order
var xref = entities.ToDictionary(x => x.Key);
- var result = keysArray.Select(x => xref.ContainsKey(x) ? xref[x] : null).Where(x => x != null);
+ var result = keys.Select(x => xref.ContainsKey(x) ? xref[x] : null).Where(x => x != null);
return result;
}
@@ -791,21 +793,21 @@ namespace Umbraco.Web.Editors
}
}
- private IEnumerable GetResultForIds(IEnumerable ids, UmbracoEntityTypes entityType)
+ private IEnumerable GetResultForIds(int[] ids, UmbracoEntityTypes entityType)
{
- var idsArray = ids.ToArray();
- if (idsArray.Any() == false) return Enumerable.Empty();
+ if (ids.Length == 0)
+ return Enumerable.Empty();
var objectType = ConvertToObjectType(entityType);
if (objectType.HasValue)
{
- var entities = Services.EntityService.GetAll(objectType.Value, idsArray)
+ var entities = Services.EntityService.GetAll(objectType.Value, ids)
.WhereNotNull()
.Select(Mapper.Map);
// entities are in "some" order, put them back in order
var xref = entities.ToDictionary(x => x.Id);
- var result = idsArray.Select(x => xref.ContainsKey(x) ? xref[x] : null).Where(x => x != null);
+ var result = ids.Select(x => xref.ContainsKey(x) ? xref[x] : null).Where(x => x != null);
return result;
}
diff --git a/src/Umbraco.Web/Editors/ParameterSwapControllerActionSelector.cs b/src/Umbraco.Web/Editors/ParameterSwapControllerActionSelector.cs
index 6eb2856912..3cb94ef8e6 100644
--- a/src/Umbraco.Web/Editors/ParameterSwapControllerActionSelector.cs
+++ b/src/Umbraco.Web/Editors/ParameterSwapControllerActionSelector.cs
@@ -48,7 +48,7 @@ namespace Umbraco.Web.Editors
return method;
}
- //if it's a post we can try to read from the body and bind from th
+ //if it's a post we can try to read from the body and bind from the json value
if (controllerContext.Request.Method == HttpMethod.Post)
{
var requestContent = new HttpMessageContent(controllerContext.Request);
diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeUdiResolver.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeUdiResolver.cs
index 142ff43a99..2d33b17155 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentTypeUdiResolver.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentTypeUdiResolver.cs
@@ -11,6 +11,8 @@ namespace Umbraco.Web.Models.Mapping
{
protected override Udi ResolveCore(IContentTypeComposition source)
{
+ if (source == null) return null;
+
return Udi.Create(
source.GetType() == typeof(IMemberType)
? Constants.UdiEntityType.MemberType
diff --git a/src/UmbracoExamine/UmbracoContentIndexer.cs b/src/UmbracoExamine/UmbracoContentIndexer.cs
index 1798596668..e7f9acdabf 100644
--- a/src/UmbracoExamine/UmbracoContentIndexer.cs
+++ b/src/UmbracoExamine/UmbracoContentIndexer.cs
@@ -775,7 +775,7 @@ namespace UmbracoExamine
fields.Add(NodeTypeAliasFieldName, allValuesForIndexing[NodeTypeAliasFieldName]);
//guid
- if (allValuesForIndexing[IconFieldName].IsNullOrWhiteSpace() == false)
+ if (allValuesForIndexing[NodeKeyFieldName].IsNullOrWhiteSpace() == false)
{
fields.Add(NodeKeyFieldName, allValuesForIndexing[NodeKeyFieldName]);
}