Browse Source

Set UTF-8 charset in Content-Type

master
JustAnotherArchivist 3 years ago
parent
commit
a5a72b73c0
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      irclog.py

+ 5
- 5
irclog.py View File

@@ -937,7 +937,7 @@ class WebServer:
if hidden:
continue
lines.append(f'{"(PW) " if auth else ""}<a href="/{html.escape(path)}">{html.escape(channel)}</a> (<a href="/{html.escape(path)}/today">today&#x27;s log</a>, <a href="/{html.escape(path)}/search">search</a>)')
return aiohttp.web.Response(text = f'<!DOCTYPE html><html lang="en"><head><title>IRC logs</title></head><body>{"<br />".join(lines)}</body></html>', content_type = 'text/html')
return aiohttp.web.Response(text = f'<!DOCTYPE html><html lang="en"><head><title>IRC logs</title></head><body>{"<br />".join(lines)}</body></html>', content_type = 'text/html; charset=UTF-8')

async def get_status(self, request):
self.logger.info(f'Received request {id(request)} from {request.remote!r} for {request.path!r}')
@@ -964,7 +964,7 @@ class WebServer:
'</body>',
'</html>'
]),
content_type = 'text/html'
content_type = 'text/html; charset=UTF-8'
)

def _file_iter_with_path(self, fn, path):
@@ -1059,7 +1059,7 @@ class WebServer:
'</body>',
'</html>',
]).encode('utf-8', errors = 'surrogateescape'),
content_type = 'text/html'
content_type = 'text/html; charset=UTF-8'
)

async def log_redirect_today(self, request):
@@ -1099,7 +1099,7 @@ class WebServer:
'</body>',
'</html>'
]),
content_type = 'text/html'
content_type = 'text/html; charset=UTF-8'
)

# Run the search with grep, limiting memory use, output size, and runtime and setting the niceness.
@@ -1201,7 +1201,7 @@ class WebServer:
'</body>',
'</html>'
]).encode('utf-8', errors = 'surrogateescape'),
content_type = 'text/html'
content_type = 'text/html; charset=UTF-8'
)




Loading…
Cancel
Save