fix: report correct file count in list quota error message#93
Merged
Conversation
In inspection/list.rs, the quota check fires when total_entries equals max_file_count (before the current entry is counted). The error was reporting current: manifest.total_entries which equals max at check time, producing nonsensical messages like "10000 > 10000". Fix: use manifest.total_entries + 1 at both TAR and ZIP quota check sites so the message correctly reflects the would-be count after adding the violating entry (e.g. "10001 > 10000"). Closes #91
f9e7317 to
a051483
Compare
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.
Summary
inspection/list.rsquota error message for both TAR and ZIP loopstotal_entries >= max_file_countfires before the current entry is counted, socurrentwas incorrectly set tomanifest.total_entries(equals the limit) instead ofmanifest.total_entries + 1(the would-be count)10001 > 10000instead of the nonsensical10000 > 10000Changes
crates/exarch-core/src/inspection/list.rs:current: manifest.total_entries→current: manifest.total_entries + 1at TAR (line ~165) and ZIP (line ~245) quota check sitescurrent == max_file_count + 1Test plan
test_list_archive_quota_exceeded(TAR): assertscurrent == 2whenmax_file_count == 1test_list_zip_quota_exceeded_file_count(ZIP): same assertionCloses #91