diff --git a/build/NuSpecs/build/UmbracoCms.targets b/build/NuSpecs/build/UmbracoCms.targets index 024d8af7ad..b057ce5202 100644 --- a/build/NuSpecs/build/UmbracoCms.targets +++ b/build/NuSpecs/build/UmbracoCms.targets @@ -1,50 +1,50 @@ - - - - - $(MSBuildThisFileDirectory)..\UmbracoFiles\ - - - - - - - - - - - App_Browsers - - - App_Code - - - App_Plugins - - - bin\amd64 - - - bin\x86 - - - Config\Splashes - + + + + + $(MSBuildThisFileDirectory)..\UmbracoFiles\ + + + + + + + + + + + App_Browsers + + + App_Code + + + App_Plugins + + + bin\amd64 + + + bin\x86 + + + Config\Splashes + data - - umbraco - - - umbraco_client - - - . - - - %(CustomFilesToInclude.Dir)\%(RecursiveDir)%(Filename)%(Extension) - - - + + umbraco + + + umbraco_client + + + . + + + %(CustomFilesToInclude.Dir)\%(RecursiveDir)%(Filename)%(Extension) + + + \ No newline at end of file diff --git a/src/Umbraco.Core/Constants-Packaging.cs b/src/Umbraco.Core/Constants-Packaging.cs index ef68b2a656..0beb034508 100644 --- a/src/Umbraco.Core/Constants-Packaging.cs +++ b/src/Umbraco.Core/Constants-Packaging.cs @@ -1,56 +1,53 @@ -using System.Xml.Linq; - -namespace Umbraco.Core -{ - public static partial class Constants - { - /// - /// Defines the constants used for Umbraco packages in the package.config xml - /// - public static class Packaging - { - public const string UmbPackageNodeName = "umbPackage"; - public const string DataTypesNodeName = "DataTypes"; - public const string PackageXmlFileName = "package.xml"; - public const string UmbracoPackageExtention = ".umb"; - public const string DataTypeNodeName = "DataType"; - public const string LanguagesNodeName = "Languages"; - public const string FilesNodeName = "files"; - public const string StylesheetsNodeName = "Stylesheets"; - public const string TemplatesNodeName = "Templates"; - public const string NameNodeName = "Name"; - public const string TemplateNodeName = "Template"; - public const string AliasNodeNameSmall = "alias"; - public const string AliasNodeNameCapital = "Alias"; - public const string DictionaryItemsNodeName = "DictionaryItems"; - public const string DictionaryItemNodeName = "DictionaryItem"; - public const string MacrosNodeName = "Macros"; - public const string DocumentSetNodeName = "DocumentSet"; - public const string DocumentTypesNodeName = "DocumentTypes"; - public const string DocumentTypeNodeName = "DocumentType"; - public const string FileNodeName = "file"; - public const string OrgNameNodeName = "orgName"; - public const string OrgPathNodeName = "orgPath"; - public const string GuidNodeName = "guid"; - public const string StylesheetNodeName = "styleSheet"; - public const string MacroNodeName = "macro"; - public const string InfoNodeName = "info"; - public const string PackageRequirementsMajorXpath = "./package/requirements/major"; - public const string PackageRequirementsMinorXpath = "./package/requirements/minor"; - public const string PackageRequirementsPatchXpath = "./package/requirements/patch"; - public const string PackageNameXpath = "./package/name"; - public const string PackageVersionXpath = "./package/version"; - public const string PackageUrlXpath = "./package/url"; - public const string PackageLicenseXpath = "./package/license"; - public const string AuthorNameXpath = "./author/name"; - public const string AuthorWebsiteXpath = "./author/website"; - public const string ReadmeXpath = "./readme"; - public const string ControlNodeName = "control"; - public const string ActionNodeName = "Action"; - public const string ActionsNodeName = "Actions"; - public const string UndoNodeAttribute = "undo"; - public const string RunatNodeAttribute = "runat"; - - } - } +namespace Umbraco.Core +{ + public static partial class Constants + { + /// + /// Defines the constants used for Umbraco packages in the package.config xml + /// + public static class Packaging + { + public static readonly string UmbPackageNodeName = "umbPackage"; + public static readonly string DataTypesNodeName = "DataTypes"; + public static readonly string PackageXmlFileName = "package.xml"; + public static readonly string UmbracoPackageExtention = ".umb"; + public static readonly string DataTypeNodeName = "DataType"; + public static readonly string LanguagesNodeName = "Languages"; + public static readonly string FilesNodeName = "files"; + public static readonly string StylesheetsNodeName = "Stylesheets"; + public static readonly string TemplatesNodeName = "Templates"; + public static readonly string NameNodeName = "Name"; + public static readonly string TemplateNodeName = "Template"; + public static readonly string AliasNodeNameSmall = "alias"; + public static readonly string AliasNodeNameCapital = "Alias"; + public static readonly string DictionaryItemsNodeName = "DictionaryItems"; + public static readonly string DictionaryItemNodeName = "DictionaryItem"; + public static readonly string MacrosNodeName = "Macros"; + public static readonly string DocumentSetNodeName = "DocumentSet"; + public static readonly string DocumentTypesNodeName = "DocumentTypes"; + public static readonly string DocumentTypeNodeName = "DocumentType"; + public static readonly string FileNodeName = "file"; + public static readonly string OrgNameNodeName = "orgName"; + public static readonly string OrgPathNodeName = "orgPath"; + public static readonly string GuidNodeName = "guid"; + public static readonly string StylesheetNodeName = "styleSheet"; + public static readonly string MacroNodeName = "macro"; + public static readonly string InfoNodeName = "info"; + public static readonly string PackageRequirementsMajorXpath = "./package/requirements/major"; + public static readonly string PackageRequirementsMinorXpath = "./package/requirements/minor"; + public static readonly string PackageRequirementsPatchXpath = "./package/requirements/patch"; + public static readonly string PackageNameXpath = "./package/name"; + public static readonly string PackageVersionXpath = "./package/version"; + public static readonly string PackageUrlXpath = "./package/url"; + public static readonly string PackageLicenseXpath = "./package/license"; + public static readonly string AuthorNameXpath = "./author/name"; + public static readonly string AuthorWebsiteXpath = "./author/website"; + public static readonly string ReadmeXpath = "./readme"; + public static readonly string ControlNodeName = "control"; + public static readonly string ActionNodeName = "Action"; + public static readonly string ActionsNodeName = "Actions"; + public static readonly string UndoNodeAttribute = "undo"; + public static readonly string RunatNodeAttribute = "runat"; + } + } } \ No newline at end of file diff --git a/src/Umbraco.Core/Packaging/UnpackHelper.cs b/src/Umbraco.Core/Packaging/UnpackHelper.cs index 0ad5397d32..970e0c85a0 100644 --- a/src/Umbraco.Core/Packaging/UnpackHelper.cs +++ b/src/Umbraco.Core/Packaging/UnpackHelper.cs @@ -10,7 +10,6 @@ namespace Umbraco.Core.Packaging { public string ReadTextFileFromArchive(string packageFilePath, string fileToRead, out string directoryInPackage) { - string retVal = null; bool fileFound = false; string foundDir = null; @@ -56,11 +55,15 @@ namespace Umbraco.Core.Packaging throw new ArgumentException(string.Format("Package file: {0} could not be found", packageFilePath)); } + string extension = Path.GetExtension(packageFilePath).ToLower(); + + var alowedExtension = new[] {".umb", ".zip"}; + // Check if the file is a valid package - if (Path.GetExtension(packageFilePath).Equals(".umb", StringComparison.InvariantCultureIgnoreCase) == false) + if (alowedExtension.All(ae => ae.Equals(extension) == false)) { throw new ArgumentException( - "Error - file isn't a package (doesn't have a .umb extension). Check if the file automatically got named '.zip' upon download."); + string.Format("Error - file isn't a package. only extentions: \"{0}\" is allowed", string.Join(", ", alowedExtension))); } } diff --git a/src/Umbraco.Tests/Packages/Netmester.BestPractice.Base_0.0.0.1.umb b/src/Umbraco.Tests/Packages/Netmester.BestPractice.Base_0.0.0.1.umb new file mode 100644 index 0000000000..11610beb1e Binary files /dev/null and b/src/Umbraco.Tests/Packages/Netmester.BestPractice.Base_0.0.0.1.umb differ diff --git a/src/Umbraco.Tests/Services/PackageInstallerServiceTest.cs b/src/Umbraco.Tests/Services/PackageInstallerServiceTest.cs index f46e243d95..6067ff0909 100644 --- a/src/Umbraco.Tests/Services/PackageInstallerServiceTest.cs +++ b/src/Umbraco.Tests/Services/PackageInstallerServiceTest.cs @@ -11,6 +11,7 @@ namespace Umbraco.Tests.Services public class PackageInstallerServiceTest : BaseServiceTest { private const string DOCUMENT_TYPE_PICKER_UMB = "Document_Type_Picker_1.1.umb"; + private const string NETMESTER_BEST_PRACTICE_BASE_UMB = "Netmester.BestPractice.Base_0.0.0.1.umb"; private const string TEST_PACKAGES_DIR_NAME = "Packages"; [SetUp] @@ -45,13 +46,28 @@ namespace Umbraco.Tests.Services var path = GetTestPackagePath(DOCUMENT_TYPE_PICKER_UMB); // Act - var importIssues = ServiceContext.PackageInstallerService.FindPackageImportIssues(path); + var importIssues = ServiceContext.PackageInstallerService.GetPreInstallWarnings(path); // Assert Assert.IsNotNull(importIssues); } + [Test] + public void PackageInstallerService_TestSomethingnew() + { + // Arrange + var path = GetTestPackagePath(NETMESTER_BEST_PRACTICE_BASE_UMB); + + // Act + var importIssues = ServiceContext.PackageInstallerService.GetPreInstallWarnings(path); + + // Assert + Assert.IsNotNull(importIssues); + } + + + [Test] public void PackageInstallerService_TestSomethingthered() {