From 8aeeba0eeb67ab870d3fa4ec625868cbcdf68c9d Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 7 Oct 2025 16:39:17 +0500 Subject: [PATCH] s3: fix ContentLength header is required error --- Notesnook.API/Controllers/S3Controller.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Notesnook.API/Controllers/S3Controller.cs b/Notesnook.API/Controllers/S3Controller.cs index b027477..39a0f09 100644 --- a/Notesnook.API/Controllers/S3Controller.cs +++ b/Notesnook.API/Controllers/S3Controller.cs @@ -65,6 +65,7 @@ namespace Notesnook.API.Controllers var subscriptionService = await WampServers.SubscriptionServer.GetServiceAsync(SubscriptionServerTopics.UserSubscriptionServiceTopic); var subscription = await subscriptionService.GetUserSubscriptionAsync(Clients.Notesnook.Id, userId); + if (subscription is null) return BadRequest(new { error = "User subscription not found." }); if (StorageHelper.IsFileSizeExceeded(subscription, fileSize)) { @@ -82,6 +83,7 @@ namespace Notesnook.API.Controllers var httpClient = new HttpClient(); var content = new StreamContent(HttpContext.Request.BodyReader.AsStream()); + content.Headers.ContentLength = Request.ContentLength; var response = await httpClient.SendRequestAsync(url, null, HttpMethod.Put, content); if (!response.Success) return BadRequest(await response.Content.ReadAsStringAsync());