From c83844468d9a30f73424a3f9e34674a63370fb32 Mon Sep 17 00:00:00 2001 From: OptimisticCoder Date: Sat, 9 Nov 2013 15:18:43 +0000 Subject: [PATCH] U4-3039 Import Document Type leaves files in App_Data Added File.Delete to clean up temp files. Added try/catch round it and logging if it fails for any reason. --- .../umbraco/dialogs/importDocumenttype.aspx.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/importDocumenttype.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/importDocumenttype.aspx.cs index 23005d62d2..27c1724bff 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/importDocumenttype.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/importDocumenttype.aspx.cs @@ -80,6 +80,16 @@ namespace umbraco.presentation.umbraco.dialogs if (contentType != null) dtNameConfirm.Text = contentType.Name; + // Try to clean up the temporary file. + try + { + System.IO.File.Delete(tempFile.Value); + } + catch(Exception ex) + { + Umbraco.Core.Logging.LogHelper.Error(typeof(importDocumentType), "Error cleaning up temporary udt file in App_Data: " + ex.Message, ex); + } + Wizard.Visible = false; Confirm.Visible = false; done.Visible = true;