From 6a07fae67ffef8d4ca67f04f2cae6e0bf1461cd2 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sun, 19 Jul 2015 23:21:27 +0100 Subject: [PATCH] Improved export file name generation. --- .../ExportActions/BuildRecipeAction.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.ImportExport/Providers/ExportActions/BuildRecipeAction.cs b/src/Orchard.Web/Modules/Orchard.ImportExport/Providers/ExportActions/BuildRecipeAction.cs index 1852b6850..5d53bf200 100644 --- a/src/Orchard.Web/Modules/Orchard.ImportExport/Providers/ExportActions/BuildRecipeAction.cs +++ b/src/Orchard.Web/Modules/Orchard.ImportExport/Providers/ExportActions/BuildRecipeAction.cs @@ -92,11 +92,18 @@ namespace Orchard.ImportExport.Providers.ExportActions { } private string GetExportFileName(Recipe recipe) { - return String.IsNullOrWhiteSpace(recipe.Name) - ? "export.xml" - : String.Format(recipe.IsSetupRecipe - ? "{0}.recipe.xml" - : "{0}.export.xml", recipe.Name.HtmlClassify()); + string format; + + if (String.IsNullOrWhiteSpace(recipe.Name) && String.IsNullOrWhiteSpace(recipe.Version)) + format = "export.xml"; + else if (String.IsNullOrWhiteSpace(recipe.Version)) + format = "{0}.recipe.xml"; + else if (String.IsNullOrWhiteSpace(recipe.Name)) + format = "export-{1}.recipe.xml"; + else + format = "{0}-{1}.recipe.xml"; + + return String.Format(format, recipe.Name.HtmlClassify(), recipe.Version); } } } \ No newline at end of file