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;