Fixes U4-1894 by ensuring that all overloads of SetValue uses the IOHelper.SafeFileName

This commit is contained in:
Morten Christensen
2013-03-22 14:18:45 -01:00
parent 6b74b75b6f
commit 4f81e06d3d

View File

@@ -117,8 +117,10 @@ namespace Umbraco.Core.Models
if (fileName.LastIndexOf(@"\") > 0)
fileName = fileName.Substring(fileName.LastIndexOf(@"\") + 1);
if (string.IsNullOrEmpty(fileName) == false)
SetFileOnContent(content, propertyTypeAlias, fileName, value.InputStream);
var name = IOHelper.SafeFileName(fileName);
if (string.IsNullOrEmpty(name) == false)
SetFileOnContent(content, propertyTypeAlias, name, value.InputStream);
}
/// <summary>
@@ -131,8 +133,10 @@ namespace Umbraco.Core.Models
public static void SetValue(this IContentBase content, string propertyTypeAlias, string fileName,
Stream fileStream)
{
if (string.IsNullOrEmpty(fileName) == false && fileStream != null)
SetFileOnContent(content, propertyTypeAlias, fileName, fileStream);
var name = IOHelper.SafeFileName(fileName);
if (string.IsNullOrEmpty(name) == false && fileStream != null)
SetFileOnContent(content, propertyTypeAlias, name, fileStream);
}
private static void SetFileOnContent(IContentBase content, string propertyTypeAlias, string name, Stream fileStream)