1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Added restricted file extensions for uploads

This commit is contained in:
Uncled1023 2018-02-14 19:54:06 -08:00
parent 0c9bbb0dfa
commit bf47978253
3 changed files with 4 additions and 2 deletions

View File

@ -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" } });
}

View File

@ -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" } });
}

View File

@ -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>();
}
}
}