@@ -90,7 +90,7 @@ namespace Teknik.Areas.API.Controllers | |||
// Check content type restrictions (Only for encrypting server side | |||
if (model.encrypt || !string.IsNullOrEmpty(model.key)) | |||
{ | |||
if (Config.UploadConfig.RestrictedContentTypes.Contains(model.contentType)) | |||
if (Config.UploadConfig.RestrictedContentTypes.Contains(model.contentType) || Config.UploadConfig.RestrictedExtensions.Contains(fileExt)) | |||
{ | |||
return Json(new { error = new { message = "File Type Not Allowed" } }); | |||
} |
@@ -88,7 +88,7 @@ namespace Teknik.Areas.Upload.Controllers | |||
// Check content type restrictions (Only for encrypting server side | |||
if (encrypt) | |||
{ | |||
if (Config.UploadConfig.RestrictedContentTypes.Contains(fileType)) | |||
if (Config.UploadConfig.RestrictedContentTypes.Contains(fileType) || Config.UploadConfig.RestrictedExtensions.Contains(fileExt)) | |||
{ | |||
return Json(new { error = new { message = "File Type Not Allowed" } }); | |||
} |
@@ -35,6 +35,7 @@ namespace Teknik.Configuration | |||
public int ClamPort { get; set; } | |||
// Content Type Restrictions | |||
public List<string> RestrictedContentTypes { get; set; } | |||
public List<string> RestrictedExtensions { get; set; } | |||
public UploadConfig() | |||
{ | |||
@@ -61,6 +62,7 @@ namespace Teknik.Configuration | |||
ClamServer = "localhost"; | |||
ClamPort = 3310; | |||
RestrictedContentTypes = new List<string>(); | |||
RestrictedExtensions = new List<string>(); | |||
} | |||
} | |||
} |