This commit is contained in:
yumoqing 2023-10-17 16:07:34 +08:00
parent 12f599ea21
commit dcfc9d7ae6

View File

@ -327,10 +327,11 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
async def html_handle(self,request,filepath): async def html_handle(self,request,filepath):
async with aiofiles.open(filepath,'r', encoding='utf-8') as f: async with aiofiles.open(filepath,'r', encoding='utf-8') as f:
txt = await f.read() txt = await f.read()
utxt = txt.encode('utf-8')
headers = { headers = {
'Content-Type': 'text/html; utf-8', 'Content-Type': 'text/html; utf-8',
'Accept-Ranges': 'bytes', 'Accept-Ranges': 'bytes',
'Content-Length': str(len(txt)) 'Content-Length': str(len(utxt))
} }
resp = Response(text=txt,headers=headers) resp = Response(text=txt,headers=headers)
return resp return resp