s3: disable download limits based on file size

This commit is contained in:
Abdullah Atta
2025-10-02 14:41:45 +05:00
committed by Abdullah Atta
parent 61dd2e1f74
commit 41a185bd9f

View File

@@ -162,15 +162,15 @@ namespace Notesnook.API.Services
public async Task<string?> GetDownloadObjectUrl(string userId, string name)
{
var subscriptionService = await WampServers.SubscriptionServer.GetServiceAsync<IUserSubscriptionService>(SubscriptionServerTopics.UserSubscriptionServiceTopic);
var subscription = await subscriptionService.GetUserSubscriptionAsync(Clients.Notesnook.Id, userId);
// var subscriptionService = await WampServers.SubscriptionServer.GetServiceAsync<IUserSubscriptionService>(SubscriptionServerTopics.UserSubscriptionServiceTopic);
// var subscription = await subscriptionService.GetUserSubscriptionAsync(Clients.Notesnook.Id, userId);
var size = await GetObjectSizeAsync(userId, name);
if (StorageHelper.IsFileSizeExceeded(subscription, size))
{
var fileSizeLimit = StorageHelper.GetFileSizeLimitForPlan(subscription);
throw new Exception($"You cannot download files larger than {StorageHelper.FormatBytes(fileSizeLimit)} on this plan.");
}
// var size = await GetObjectSizeAsync(userId, name);
// if (StorageHelper.IsFileSizeExceeded(subscription, size))
// {
// var fileSizeLimit = StorageHelper.GetFileSizeLimitForPlan(subscription);
// throw new Exception($"You cannot download files larger than {StorageHelper.FormatBytes(fileSizeLimit)} on this plan.");
// }
var url = this.GetPresignedURL(userId, name, HttpVerb.GET);
if (url == null) return null;