diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js index 28398d081a..00fda4db21 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js +++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js @@ -189,8 +189,12 @@ top.UmbSpeechBubble.ShowMessage('save', header, msg); - this._opts.originalFileName = args.name; - this._opts.treeSyncPath = args.path; + if (args && args.name) { + this._opts.originalFileName = args.name; + } + if (args && args.path) { + this._opts.treeSyncPath = args.path; + } UmbClientMgr.mainTree().syncTree(path, true, null, newFilePath.split("/")[1]); } diff --git a/src/Umbraco.Web/WebServices/SaveFileController.cs b/src/Umbraco.Web/WebServices/SaveFileController.cs index 24f6917e76..f18f690b87 100644 --- a/src/Umbraco.Web/WebServices/SaveFileController.cs +++ b/src/Umbraco.Web/WebServices/SaveFileController.cs @@ -97,22 +97,25 @@ namespace Umbraco.Web.WebServices oldname = oldname.TrimStart(pathPrefix); } - var view = get(svce, oldname); - if (view == null) - view = new PartialView(filename); + var currentView = oldname.IsNullOrWhiteSpace() + ? get(svce, filename) + : get(svce, oldname); + + if (currentView == null) + currentView = new PartialView(filename); else - view.Path = filename; - view.Content = contents; + currentView.Path = filename; + currentView.Content = contents; Attempt attempt; try { - var partialView = view as PartialView; + var partialView = currentView as PartialView; if (partialView != null && validate != null && validate(svce, partialView) == false) return Failed(ui.Text("speechBubbles", "partialViewErrorText"), ui.Text("speechBubbles", "partialViewErrorHeader"), - new FileSecurityException("File '" + view.Path + "' is not a valid partial view file.")); + new FileSecurityException("File '" + currentView.Path + "' is not a valid partial view file.")); - attempt = save(svce, view); + attempt = save(svce, currentView); } catch (Exception e) {