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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hopleus
Copy link
Contributor

@hopleus hopleus commented Mar 18, 2024

Summary

Fixed the problem with incorrect output of "free" when receiving stat

Use case

If you connect an ObjectStore, for example S3, and do not set a quota for the user, then NextCloud returns the total free space, and since the ObjectStore is connected, "-2" (SPACE_UNKNOWN) is returned. When the frontend receives data, it relies on the "free" field to display a warning about the lack of disk space, which is not correct, because there is disk space, but it cannot be obtained due to the connected ObjectStore.

Checklist

@susnux susnux added this to the Nextcloud 30 milestone Apr 18, 2024
@skjnldsv
Copy link
Member

skjnldsv commented May 30, 2024

@hopleus please remove the merge commits, if you want to keep your PR up to date, please use rebase to master instead 🙏

EDIT: I did it for you :)

@skjnldsv skjnldsv requested review from a team, ArtificialOwl, icewind1991, sorbaugh, artonge and come-nc and removed request for a team May 30, 2024 12:02
Signed-off-by: hopleus <hopleus@gmail.com>
@skjnldsv skjnldsv force-pushed the bugfix/fix-incorrect-free-in-stats branch from 2811068 to c6a32b6 Compare May 30, 2024 12:05
@hopleus
Copy link
Contributor Author

hopleus commented May 30, 2024

@hopleus please remove the merge commits, if you want to keep your PR up to date, please use rebase to master instead 🙏

EDIT: I did it for you :)

I am very grateful to you. In the future, I will keep in mind

Comment on lines +525 to +531

// 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;
}
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?

Copy link
Member

@icewind1991 icewind1991 left a comment

Choose a reason for hiding this comment

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

The frontend should be adjusted instead to handle these values instead

This was referenced Jul 30, 2024
@Altahrim Altahrim mentioned this pull request Aug 5, 2024
@skjnldsv skjnldsv added 2. developing Work in progress stale Ticket or PR with no recent activity and removed 3. to review Waiting for reviews labels Aug 6, 2024
@Altahrim Altahrim mentioned this pull request Aug 7, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 13, 2024
@skjnldsv skjnldsv modified the milestones: Nextcloud 30, Nextcloud 31 Aug 14, 2024
@joshtrichards
Copy link
Member

Related front-end PR #43666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug feature: files stale Ticket or PR with no recent activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants