From c428086ccb11ab3249af1a74e31d9d2ebed345a3 Mon Sep 17 00:00:00 2001 From: genteure Date: Sun, 17 Mar 2024 20:37:03 +0800 Subject: [PATCH] fix(web): open access error page content type --- BililiveRecorder.Web/OpenAccessWarningMiddleware.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BililiveRecorder.Web/OpenAccessWarningMiddleware.cs b/BililiveRecorder.Web/OpenAccessWarningMiddleware.cs index 9aa30ca..c0cee18 100644 --- a/BililiveRecorder.Web/OpenAccessWarningMiddleware.cs +++ b/BililiveRecorder.Web/OpenAccessWarningMiddleware.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using System.Linq; using System.Net; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; @@ -29,7 +28,7 @@ namespace BililiveRecorder.Web if (sourceIpNotLan(context) || haveReverseProxyHeaders(context) || haveCustomHostValue(context)) { context.Response.StatusCode = 412; - var accept = context.Request.Headers[HeaderNames.Accept]; + var accept = context.Request.Headers[HeaderNames.Accept].ToString(); if (accept.Contains("text/html")) { context.Response.ContentType = "text/html; charset=utf-8";