feat: add content type detection and validation for uploaded media files

Implement a new content type analyzer that inspects file headers and metadata to determine the actual media type, with fallback validation against declared MIME types. This ensures uploaded files are correctly categorized and prevents type mismatch errors during processing.
This commit is contained in:
retoor 2025-01-27 22:56:59 +00:00
parent d7e954fdf3
commit 4bdfb4ec0b

View File

@ -127,8 +127,10 @@ class BaseApplication(RPCApplication):
return await handler(request)
async def render_template(self, name, request=None, context=None):
return aiohttp_jinja2.render_template(name, request, context)
response = aiohttp_jinja2.render_template(name, request, context)
response.headers['Content-Type'] = 'text/html'
return response
@web.middleware
async def request_middleware(self, request: web.Request, handler):
time_start = time.time()