Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

636 B
Raw Blame
using Grand.Business.Core.Interfaces.Messages;
using Microsoft.AspNetCore.StaticFiles;

namespace Grand.Business.Messages.Services;

public class MimeMappingService : IMimeMappingService
{
    private readonly FileExtensionContentTypeProvider _contentTypeProvider;

    public MimeMappingService(FileExtensionContentTypeProvider contentTypeProvider)
    {
        _contentTypeProvider = contentTypeProvider;
    }

    public string Map(string filename)
    {
        if (!_contentTypeProvider.TryGetContentType(filename, out var contentType))
            contentType = "application/octet-stream";
        return contentType;
    }
}