瀏覽代碼

Merge pull request #3037 from ConfusedPolarBear/access-control

Fix CORS header not being added to exceptions
Vasily 5 年之前
父節點
當前提交
d9e2f56bd2
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

+ 9 - 0
Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -496,6 +496,15 @@ namespace Emby.Server.Implementations.HttpServer
                 {
                     var requestInnerEx = GetActualException(requestEx);
                     var statusCode = GetStatusCode(requestInnerEx);
+
+                    foreach (var (key, value) in GetDefaultCorsHeaders(httpReq))
+                    {
+                        if (!httpRes.Headers.ContainsKey(key))
+                        {
+                            httpRes.Headers.Add(key, value);
+                        }
+                    }
+
                     bool ignoreStackTrace =
                         requestInnerEx is SocketException
                         || requestInnerEx is IOException