Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes incorrect "free" value in stat #44274

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,13 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin
$total = $free + $used;
} else {
$total = $free; //either unknown or unlimited

// So that the front does not react to a negative free space value and does not show appropriate warnings
if ($free === \OCP\Files\FileInfo::SPACE_UNKNOWN
|| $free === \OCP\Files\FileInfo::SPACE_UNLIMITED
|| $free === \OCP\Files\FileInfo::SPACE_NOT_COMPUTED) {
$free = PHP_INT_MAX;
}
Comment on lines +525 to +531
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure I like doing that here. It might break other code paths expecting to get the information when the free space is unknown.
Couldn’t the frontend be adapted instead?

}
if ($total > 0) {
if ($quota > 0 && $total > $quota) {
Expand Down
Loading