From d0c8ed567c8c3b750d40ad613a65b9f0614440bc Mon Sep 17 00:00:00 2001 From: Uncled1023 Date: Wed, 2 Nov 2016 21:47:00 -0700 Subject: [PATCH] Added check for html files on upload and return them as plain text. --- Teknik/Areas/Upload/Controllers/UploadController.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Teknik/Areas/Upload/Controllers/UploadController.cs b/Teknik/Areas/Upload/Controllers/UploadController.cs index 818d450..957f386 100644 --- a/Teknik/Areas/Upload/Controllers/UploadController.cs +++ b/Teknik/Areas/Upload/Controllers/UploadController.cs @@ -283,7 +283,14 @@ namespace Teknik.Areas.Upload.Controllers Response.AppendHeader("Content-Disposition", cd.ToString()); - return File(data, upload.ContentType); + string contentType = upload.ContentType; + // We need to prevent html (make cleaner later) + if (contentType == "text/html") + { + contentType = "text/plain"; + } + + return File(data, contentType); } } }