Handling Advanced Device model creation across different browsers (#269)

This commit is contained in:
sasathy 2018-10-09 18:06:53 -07:00 коммит произвёл Harleen Thind
Родитель d1a986f1dd
Коммит ab4fef17d4
2 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -176,6 +176,9 @@ namespace WebService.Test.v1.Controllers
{
// Arrange
var fileMock = new Mock<IFormFile>();
const string FILE_NAME = "test.docx";
fileMock.Setup(x => x.FileName).Returns(FILE_NAME);
// Act & Assert
Assert.Throws<BadRequestException>(() => this.target.Validate(fileMock.Object));

Просмотреть файл

@ -58,7 +58,7 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.WebService.v1.Controller
throw new BadRequestException("No data provided.");
}
if (file.ContentType != TEXT_JAVASCRIPT)
if (file.ContentType != TEXT_JAVASCRIPT && !file.FileName.EndsWith(".js"))
{
this.log.Warn("Wrong content type provided", () => new { file.ContentType });
throw new BadRequestException("Wrong content type provided.");
@ -93,7 +93,7 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.WebService.v1.Controller
throw new BadRequestException("No data provided.");
}
if (file.ContentType != TEXT_JAVASCRIPT)
if (file.ContentType != TEXT_JAVASCRIPT && !file.FileName.EndsWith(".js"))
{
this.log.Warn("Wrong content type provided", () => new { file.ContentType });
throw new BadRequestException("Wrong content type provided.");