From 0cc88a17067e40f07f609acfd419dceb790bb849 Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 26 Sep 2016 20:03:14 +0200 Subject: [PATCH] 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 --- src/Umbraco.Core/IO/UmbracoMediaFile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/IO/UmbracoMediaFile.cs b/src/Umbraco.Core/IO/UmbracoMediaFile.cs index d708fcb804..f7076be234 100644 --- a/src/Umbraco.Core/IO/UmbracoMediaFile.cs +++ b/src/Umbraco.Core/IO/UmbracoMediaFile.cs @@ -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);