Skip to content

The Free Software Media System - Server Backend & API

Don't send Exception message in Production Environment

Davide9ebe07ecc38
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 7de4f168c1..9e8c3eb9be 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -230,6 +230,12 @@ namespace Emby.Server.Implementations.HttpServer
httpRes.StatusCode = statusCode;
+ if (!_hostEnvironment.IsDevelopment())
+ {
+ await httpRes.WriteAsync("Error processing request.").ConfigureAwait(false);
+ return;
+ }
+
var errContent = NormalizeExceptionMessage(ex) ?? string.Empty;
httpRes.ContentType = "text/plain";
httpRes.ContentLength = errContent.Length;