FileController - content disposition

This commit is contained in:
Pavel Vesely
2020-12-15 10:49:48 +01:00
parent deaaa74fc8
commit 07711c082e
5 changed files with 93 additions and 27 deletions

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.StaticFiles;
using Oqtane.Models;
namespace Oqtane.Extensions
{
@ -15,17 +16,5 @@ namespace Oqtane.Extensions
return list.Any(f => s.StartsWith(f));
}
public static string GetMimeType(this string fileName)
{
var provider = new FileExtensionContentTypeProvider();
if (!provider.TryGetContentType(fileName, out var contentType))
{
contentType = "application/octet-stream";
}
return contentType;
}
}
}