Fix uploadFilesize check: use >= comparison instead of string equality#27
Merged
BornToBeRoot merged 3 commits intomainfrom Apr 1, 2026
Merged
Fix uploadFilesize check: use >= comparison instead of string equality#27BornToBeRoot merged 3 commits intomainfrom
BornToBeRoot merged 3 commits intomainfrom
Conversation
Agent-Logs-Url: https://github.com/BornToBeRoot/check_nextcloud/sessions/30b7a011-3bd9-4f17-9848-1915e4c70f63 Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
BornToBeRoot
April 1, 2026 20:20
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the uploadFilesize check to compare numeric byte values (minimum required vs. server-reported limit) instead of requiring an exact string match, preventing false CRITICAL results due to formatting differences or higher-than-minimum limits.
Changes:
- Added
convert_size_to_bytes()to parse human-readable size strings into byte counts. - Updated
uploadFilesizelogic from strict string equality to a>=numeric comparison. - Adjusted the OK output to show both the actual and expected configured values.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
uploadFilesizecheck used strict string equality againstcalc_size_suffix()output, meaning any value above the threshold (or any formatting difference) would trigger a false CRITICAL. The check should pass as long as the server's limit meets or exceeds the specified minimum.Changes
convert_size_to_bytes()— converts human-readable size strings (512.0MiB,1GiB,2 gigabytes, etc.) to bytes; handles IEC binary (KiB/MiB/…), decimal abbreviations (KB/MB/…), full words, and plural formsuploadFilesizecomparison — changed from==string match toconvert_size_to_bytes(actual) >= convert_size_to_bytes(expected)numeric comparisonOK - Upload max filesize: 1.0GiB >= 512.0MiBImplements the logic from PR #12 with Python 3 compatibility.
Close #12