Merge commit '874f464a2b51000920e2323f93bea116546e9b88' into 7.1.5

Conflicts:
	src/Umbraco.Core/IO/FileSystemExtensions.cs
	src/Umbraco.Core/IO/UmbracoMediaFile.cs
	src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs
This commit is contained in:
Shannon
2014-07-10 11:53:45 +10:00
6 changed files with 85 additions and 69 deletions

View File

@@ -90,10 +90,16 @@ namespace Umbraco.Core.IO
public void AddFile(string path, Stream stream, bool overrideIfExists)
{
if (FileExists(path) && !overrideIfExists) throw new InvalidOperationException(string.Format("A file at path '{0}' already exists", path));
var exists = FileExists(path);
if (exists && overrideIfExists == false) throw new InvalidOperationException(string.Format("A file at path '{0}' already exists", path));
EnsureDirectory(Path.GetDirectoryName(path));
if (exists)
{
DeleteFile(path);
}
if (stream.CanSeek)
stream.Seek(0, 0);