Skip to content

Commit

Permalink
Merge pull request #8595 from ThomasWaldmann/storage-quota-zero-1.4
Browse files Browse the repository at this point in the history
config: fix acceptance of storage_quota 0, fixes #8499
  • Loading branch information
ThomasWaldmann authored Dec 24, 2024
2 parents 2dfb091 + e74c912 commit 6bbbf3c
Showing 1 changed file with 4 additions and 2 deletions.
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 wrapper(self, args, repository, key, manifest, **kwargs):

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 @@ def repo_validate(section, name, value=None, check_value=True):
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')
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

0 comments on commit 6bbbf3c

Please sign in to comment.