Remove OriginalMediaPathScheme, changes how we extract the media file path and use that correctly instead of hacks.

This commit is contained in:
Shannon
2021-07-07 14:36:52 -06:00
parent 6402a0ca8d
commit 3eb54831cb
26 changed files with 274 additions and 289 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -146,17 +146,21 @@ namespace Umbraco.Cms.Core.IO
var fullPath = GetFullPath(path);
var exists = File.Exists(fullPath);
if (exists && overrideExisting == false)
{
throw new InvalidOperationException(string.Format("A file at path '{0}' already exists", path));
}
var directory = Path.GetDirectoryName(fullPath);
if (directory == null) throw new InvalidOperationException("Could not get directory.");
Directory.CreateDirectory(directory); // ensure it exists
if (stream.CanSeek) // TODO: what if we cannot?
if (stream.CanSeek)
{
stream.Seek(0, 0);
}
using (var destination = (Stream) File.Create(fullPath))
stream.CopyTo(destination);
using var destination = (Stream)File.Create(fullPath);
stream.CopyTo(destination);
}
/// <summary>