Bugfix in Initialize method of UmbracoMediaFile

GetExtension returns an empty string instead of null which causes the
substring to return an argumentoutofrange exception. Discovered this
when trying to use Save(HttpPostedFile file) and Save(HttpPostedFileBase
file), but since the temporary generated path didn't include an
extension, these methods always threw an exception
This commit is contained in:
Mark
2016-09-26 20:03:14 +02:00
parent 03f16dfb78
commit 0cc88a1706

View File

@@ -86,7 +86,7 @@ namespace Umbraco.Core.IO
private void Initialize()
{
Filename = _fs.GetFileName(Path);
Extension = _fs.GetExtension(Path) != null
Extension = !string.IsNullOrEmpty(_fs.GetExtension(Path))
? _fs.GetExtension(Path).Substring(1).ToLowerInvariant()
: "";
Url = _fs.GetUrl(Path);