diff --git a/Lombiq.Hosting.Tenants.EnvironmentRobots/Manifest.cs b/Lombiq.Hosting.Tenants.EnvironmentRobots/Manifest.cs index 2d22ed72..693a6db9 100644 --- a/Lombiq.Hosting.Tenants.EnvironmentRobots/Manifest.cs +++ b/Lombiq.Hosting.Tenants.EnvironmentRobots/Manifest.cs @@ -6,7 +6,8 @@ Author = "Lombiq Technologies", Website = "https://github.com/Lombiq/Hosting-Tenants", Version = "0.0.1", - Description = "Prevents search bots from indexing non-production environments by adding a meta tag and a response header with noindex, nofollow values.", + Description = "Prevents search bots from indexing non-production environments by adding a meta tag and a response" + + " header with noindex, nofollow values.", Category = "Hosting" )] diff --git a/Lombiq.Hosting.Tenants.MediaStorageManagement/Service/IMediaStorageQuotaService.cs b/Lombiq.Hosting.Tenants.MediaStorageManagement/Service/IMediaStorageQuotaService.cs index 3ce70fa7..2579af71 100644 --- a/Lombiq.Hosting.Tenants.MediaStorageManagement/Service/IMediaStorageQuotaService.cs +++ b/Lombiq.Hosting.Tenants.MediaStorageManagement/Service/IMediaStorageQuotaService.cs @@ -8,7 +8,7 @@ namespace Lombiq.Hosting.Tenants.MediaStorageManagement.Service; public interface IMediaStorageQuotaService { /// - /// Returns remaining quota space left in bytes. + /// Returns remaining quota space left in bytes. It is always a non-negative number, meaning the minimum value is 0. /// Task GetRemainingMediaSpaceQuotaLeftAsync(); diff --git a/Lombiq.Hosting.Tenants.MediaStorageManagement/Service/MediaStorageQuotaService.cs b/Lombiq.Hosting.Tenants.MediaStorageManagement/Service/MediaStorageQuotaService.cs index b519044a..53127025 100644 --- a/Lombiq.Hosting.Tenants.MediaStorageManagement/Service/MediaStorageQuotaService.cs +++ b/Lombiq.Hosting.Tenants.MediaStorageManagement/Service/MediaStorageQuotaService.cs @@ -25,7 +25,9 @@ public async Task GetRemainingMediaSpaceQuotaLeftAsync() var listed = await directoryContent.ToListAsync(); var sumSize = listed.Where(item => item.Length > 0).Sum(item => item.Length); - return MaxSpaceForTenantInBytes() - sumSize; + var remainingSpace = MaxSpaceForTenantInBytes() - sumSize; + + return remainingSpace < 0 ? 0 : remainingSpace; } public long MaxSpaceForTenantInBytes() => _mediaStorageManagementOptions.MaximumStorageQuota;