Force the allowed avatar image types. We do not want to use the Umbraco:Cms:Content:Imaging:ImageFileTypes as this could very well be different for content.
This commit is contained in:
committed by
Sebastiaan Janssen
parent
19b2dee76a
commit
6ce9ea4950
@@ -179,8 +179,9 @@ public class UsersController : BackOfficeNotificationsController
|
||||
var fileName = file.FileName.Trim(new[] { '\"' }).TrimEnd();
|
||||
var safeFileName = fileName.ToSafeFileName(shortStringHelper);
|
||||
var ext = safeFileName.Substring(safeFileName.LastIndexOf('.') + 1).ToLower();
|
||||
const string allowedAvatarFileTypes = "jpeg,jpg,gif,bmp,png,tiff,tif,webp";
|
||||
|
||||
if (contentSettings.DisallowedUploadFiles.Contains(ext) == false)
|
||||
if (allowedAvatarFileTypes.Contains(ext) == true && contentSettings.DisallowedUploadFiles.Contains(ext) == false)
|
||||
{
|
||||
//generate a path of known data, we don't want this path to be guessable
|
||||
user.Avatar = "UserAvatars/" + (user.Id + safeFileName).GenerateHash<SHA1>() + "." + ext;
|
||||
|
||||
Reference in New Issue
Block a user