diff --git a/CHANGELOG.md b/CHANGELOG.md
index 846ff0f..e3cbade 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [2.0.67] - 2024-04-08
+## [2.0.68] - 2024-04-09
+### Changed
+- Base Href middleware fix that throws error when a response is not 200.
+
+## [2.0.67] - 2024-04-09
### Changed
- Symlink fixes.
diff --git a/client/src/app/navbar/navbar.component.html b/client/src/app/navbar/navbar.component.html
index ad737c5..9aeaa5d 100644
--- a/client/src/app/navbar/navbar.component.html
+++ b/client/src/app/navbar/navbar.component.html
@@ -55,7 +55,7 @@
Profile
Logout
- Version 2.0.67
+ Version 2.0.68
diff --git a/package.json b/package.json
index 1c3c137..f246d58 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "rdt-client",
- "version": "2.0.67",
+ "version": "2.0.68",
"description": "This is a web interface to manage your torrents on Real-Debrid.",
"main": "index.js",
"dependencies": {
diff --git a/server/RdtClient.Service/Middleware/BaseHrefMiddleware.cs b/server/RdtClient.Service/Middleware/BaseHrefMiddleware.cs
index 39bcf7a..747e0ce 100644
--- a/server/RdtClient.Service/Middleware/BaseHrefMiddleware.cs
+++ b/server/RdtClient.Service/Middleware/BaseHrefMiddleware.cs
@@ -23,20 +23,22 @@ public class BaseHrefMiddleware(RequestDelegate next, String basePath)
newBody.Seek(0, SeekOrigin.Begin);
var responseBody = await new StreamReader(newBody).ReadToEndAsync();
- // ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
- if (context.Response.ContentType?.Contains("text/html") == true)
+ if (context.Response.StatusCode == 200)
{
- responseBody = Regex.Replace(responseBody, @")", $"$1{_basePath}$2$3");
- responseBody = Regex.Replace(responseBody, "()", $"$1{_basePath}$2$3");
+ if (context.Response.ContentType?.Contains("text/html") == true)
+ {
+ responseBody = Regex.Replace(responseBody, @")", $"$1{_basePath}$2$3");
+ responseBody = Regex.Replace(responseBody, "()", $"$1{_basePath}$2$3");
+
+ context.Response.Headers.Remove("Content-Length");
+ await context.Response.WriteAsync(responseBody);
+ }
+ else
+ {
+ await context.Response.BodyWriter.WriteAsync(newBody.ToArray());
+ }
}
}
finally
diff --git a/server/RdtClient.Web/RdtClient.Web.csproj b/server/RdtClient.Web/RdtClient.Web.csproj
index 7388d4d..d57e05f 100644
--- a/server/RdtClient.Web/RdtClient.Web.csproj
+++ b/server/RdtClient.Web/RdtClient.Web.csproj
@@ -4,7 +4,7 @@
net8.0
Exe
94c24cba-f03f-4453-a671-3640b517c573
- 2.0.67
+ 2.0.68
enable
enable
latest