Fixes
now the package does not die hard if data type not found directories in umb packages are now ignored - not sure if this is th right behaver small logical errors
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,12 +76,23 @@ namespace Umbraco.Core.Services
|
||||
/// Gets a <see cref="IDataTypeDefinition"/> by its control Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the DataType control</param>
|
||||
/// <param name="throwIfNotFound"></param>
|
||||
/// <returns>Collection of <see cref="IDataTypeDefinition"/> objects with a matching contorl id</returns>
|
||||
[Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the overload GetDataTypeDefinitionByPropertyEditorAlias instead")]
|
||||
public IEnumerable<IDataTypeDefinition> GetDataTypeDefinitionByControlId(Guid id, bool throwIfNotFound)
|
||||
{
|
||||
var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(id, throwIfNotFound);
|
||||
if (alias == null)
|
||||
{
|
||||
return Enumerable.Empty<IDataTypeDefinition>();
|
||||
}
|
||||
return GetDataTypeDefinitionByPropertyEditorAlias(alias);
|
||||
}
|
||||
|
||||
[Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the overload GetDataTypeDefinitionByPropertyEditorAlias instead")]
|
||||
public IEnumerable<IDataTypeDefinition> GetDataTypeDefinitionByControlId(Guid id)
|
||||
{
|
||||
var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(id, true);
|
||||
return GetDataTypeDefinitionByPropertyEditorAlias(alias);
|
||||
return GetDataTypeDefinitionByControlId(id, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<IDataTypeDefinition> GetDataTypeDefinitionByControlId(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IDataTypeDefinition"/> by its control Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the DataType control</param>
|
||||
/// <param name="throwIfNotFound">Throw exception if the type is not found if true. If false return empty Enumerable if not found</param>
|
||||
/// <returns><see cref="IDataTypeDefinition"/></returns>
|
||||
[Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the overload GetDataTypeDefinitionByPropertyEditorAlias instead")]
|
||||
IEnumerable<IDataTypeDefinition> GetDataTypeDefinitionByControlId(Guid id, bool throwIfNotFound);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IDataTypeDefinition"/> by its control Id
|
||||
/// </summary>
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user