Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 123affbb authored by Akhil's avatar Akhil
Browse files

Add also negative value check

parent 6fd7f8ab
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -24,13 +24,14 @@
 		if ($owner) {
--- lib/private/Files/Storage/Wrapper/Quota.php	2024-02-28 23:45:03.136041704 +0530
+++ lib/private/Files/Storage/Wrapper/Quota-new.php	2024-02-28 23:49:24.518192286 +0530
@@ -117,7 +117,9 @@
@@ -117,7 +117,10 @@
 				return FileInfo::SPACE_NOT_COMPUTED;
 			} else {
 				$free = $this->storage->free_space($path);
-				$quotaFree = max($this->getQuota() - $used, 0);
+				$ownerId = $this->storage->getUser()->getUID();
+				$mailQuotaUsage = (int) \OC::$server->getConfig()->getUserValue($ownerId, 'ecloud-accounts', 'mailQuotaUsage', 0);
+				$mailQuotaUsage = max($mailQuotaUsage, 0); // to avoid negative mail quota usage value
+				$quotaFree = max($this->getQuota() - $used - $mailQuotaUsage, 0);
 				// if free space is known
 				$free = $free >= 0 ? min($free, $quotaFree) : $quotaFree;