diff --git a/src/Umbraco.Core/Packaging/UnpackHelper.cs b/src/Umbraco.Core/Packaging/UnpackHelper.cs
index b8a7ad3fb5..832afacf3e 100644
--- a/src/Umbraco.Core/Packaging/UnpackHelper.cs
+++ b/src/Umbraco.Core/Packaging/UnpackHelper.cs
@@ -19,7 +19,9 @@ namespace Umbraco.Core.Packaging
ZipEntry zipEntry;
while ((zipEntry = zipStream.GetNextEntry()) != null)
{
- if (zipEntry.Name.EndsWith(fileToRead, StringComparison.CurrentCultureIgnoreCase))
+ string fileName = Path.GetFileName(zipEntry.Name);
+
+ if (string.IsNullOrEmpty(fileName) == false && fileName.Equals(fileToRead, StringComparison.CurrentCultureIgnoreCase))
{
using (var reader = new StreamReader(zipStream))
{
@@ -58,7 +60,9 @@ namespace Umbraco.Core.Packaging
ZipEntry zipEntry;
while ((zipEntry = zipInputStream.GetNextEntry()) != null)
{
- if(zipEntry.Name.Equals(fileInPackageName))
+ string fileName = Path.GetFileName(zipEntry.Name);
+
+ if (string.IsNullOrEmpty(fileName) == false && fileName.Equals(fileInPackageName, StringComparison.InvariantCultureIgnoreCase))
{
fileFoundInArchive = true;
@@ -94,7 +98,7 @@ namespace Umbraco.Core.Packaging
{
CheckPackageExists(packageFilePath);
- var exp = expectedFiles.ToDictionary(k => k, v => true);
+ var retVal = expectedFiles.ToList();
using (var fs = File.OpenRead(packageFilePath))
{
@@ -103,10 +107,11 @@ namespace Umbraco.Core.Packaging
ZipEntry zipEntry;
while ((zipEntry = zipInputStream.GetNextEntry()) != null)
{
- if (exp.ContainsKey(zipEntry.Name))
- {
- exp[zipEntry.Name] = false;
- }
+ string fileName = Path.GetFileName(zipEntry.Name);
+
+ int index = retVal.FindIndex(f => f.Equals(fileName, StringComparison.InvariantCultureIgnoreCase));
+
+ if (index != -1) { retVal.RemoveAt(index); }
}
zipInputStream.Close();
@@ -115,7 +120,7 @@ namespace Umbraco.Core.Packaging
}
- return exp.Where(kv => kv.Value).Select(kv => kv.Key);
+ return retVal;
}
}
diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs
index f1bf4d1321..81d4cba48e 100644
--- a/src/Umbraco.Core/Services/DataTypeService.cs
+++ b/src/Umbraco.Core/Services/DataTypeService.cs
@@ -76,12 +76,23 @@ namespace Umbraco.Core.Services
/// Gets a by its control Id
///
/// Id of the DataType control
+ ///
/// Collection of objects with a matching contorl id
+ [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the overload GetDataTypeDefinitionByPropertyEditorAlias instead")]
+ public IEnumerable GetDataTypeDefinitionByControlId(Guid id, bool throwIfNotFound)
+ {
+ var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(id, throwIfNotFound);
+ if (alias == null)
+ {
+ return Enumerable.Empty();
+ }
+ return GetDataTypeDefinitionByPropertyEditorAlias(alias);
+ }
+
[Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the overload GetDataTypeDefinitionByPropertyEditorAlias instead")]
public IEnumerable GetDataTypeDefinitionByControlId(Guid id)
{
- var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(id, true);
- return GetDataTypeDefinitionByPropertyEditorAlias(alias);
+ return GetDataTypeDefinitionByControlId(id, true);
}
///
diff --git a/src/Umbraco.Core/Services/IDataTypeService.cs b/src/Umbraco.Core/Services/IDataTypeService.cs
index 7bf938aa25..d0da5a64a8 100644
--- a/src/Umbraco.Core/Services/IDataTypeService.cs
+++ b/src/Umbraco.Core/Services/IDataTypeService.cs
@@ -79,6 +79,15 @@ namespace Umbraco.Core.Services
[Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the overload GetDataTypeDefinitionByPropertyEditorAlias instead")]
IEnumerable GetDataTypeDefinitionByControlId(Guid id);
+ ///
+ /// Gets a by its control Id
+ ///
+ /// Id of the DataType control
+ /// Throw exception if the type is not found if true. If false return empty Enumerable if not found
+ ///
+ [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the overload GetDataTypeDefinitionByPropertyEditorAlias instead")]
+ IEnumerable GetDataTypeDefinitionByControlId(Guid id, bool throwIfNotFound);
+
///
/// Gets a by its control Id
///
diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs
index 03e039be87..5dfd32a231 100644
--- a/src/Umbraco.Core/Services/PackagingService.cs
+++ b/src/Umbraco.Core/Services/PackagingService.cs
@@ -568,7 +568,7 @@ namespace Umbraco.Core.Services
if (dataTypeDefinition == null)
{
var dataTypeDefinitions = legacyPropertyEditorId != Guid.Empty
- ? _dataTypeService.GetDataTypeDefinitionByControlId(legacyPropertyEditorId)
+ ? _dataTypeService.GetDataTypeDefinitionByControlId(legacyPropertyEditorId, false)
: _dataTypeService.GetDataTypeDefinitionByPropertyEditorAlias(propertyEditorAlias);
if (dataTypeDefinitions != null && dataTypeDefinitions.Any())
{