api: fix minor issues

This commit is contained in:
Abdullah Atta
2025-10-03 08:34:20 +05:00
committed by Abdullah Atta
parent 41a185bd9f
commit 908d64bd4f
4 changed files with 14 additions and 6 deletions

View File

@@ -56,6 +56,13 @@ namespace Notesnook.API.Controllers
if (!HttpContext.Request.Headers.ContentLength.HasValue) return BadRequest(new { error = "No Content-Length header found." });
long fileSize = HttpContext.Request.Headers.ContentLength.Value;
if (fileSize == 0)
{
var uploadUrl = S3Service.GetUploadObjectUrl(userId, name);
if (uploadUrl == null) return BadRequest(new { error = "Could not create signed url." });
return Ok(uploadUrl);
}
var subscriptionService = await WampServers.SubscriptionServer.GetServiceAsync<IUserSubscriptionService>(SubscriptionServerTopics.UserSubscriptionServiceTopic);
var subscription = await subscriptionService.GetUserSubscriptionAsync(Clients.Notesnook.Id, userId);