Skip to content

config: fix acceptance of storage_quota 0, fixes #8499 #8595

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

Merged
Merged
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
6 changes: 4 additions & 2 deletions src/borg/archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@

def parse_storage_quota(storage_quota):
parsed = parse_file_size(storage_quota)
if parsed < parse_file_size('10M'):
if parsed != 0 and parsed < parse_file_size('10M'):
raise argparse.ArgumentTypeError('quota is too small (%s). At least 10M are required.' % storage_quota)
return parsed

Expand Down Expand Up @@ -1919,7 +1919,9 @@
except ValueError:
raise ValueError('Invalid value') from None
if name == 'storage_quota':
if parse_file_size(value) < parse_file_size('10M'):
wanted = parse_file_size(value)
minimum = parse_file_size('10M')

Check warning on line 1923 in src/borg/archiver.py

View check run for this annotation

Codecov / codecov/patch

src/borg/archiver.py#L1922-L1923

Added lines #L1922 - L1923 were not covered by tests
if wanted != 0 and wanted < minimum:
raise ValueError('Invalid value: storage_quota < 10M')
elif name == 'max_segment_size':
if parse_file_size(value) >= MAX_SEGMENT_SIZE_LIMIT:
Expand Down
Loading