Skip to content
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
10 changes: 5 additions & 5 deletions distributions/validate-modern.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def validate_mode(path: str, mode, uid, gid, max_size = None, optional = False,
warning(node, f'file: "{path}" has unexpected gid: {info.gid} (expected: {gid})')

if max_size is not None and info.size > max_size:
error(node, f'file: "{path}" is too big (info.size), max: {max_size}')
error(node, f'file: "{path}" is too big ({info.size}), max: {max_size}')

if magic is not None or parse_method is not None:
content = tar.extractfile(real_path)
Expand All @@ -409,12 +409,12 @@ def validate_mode(path: str, mode, uid, gid, max_size = None, optional = False,
return True

def validate_config(path: str, valid_keys: list):
_, path = get_tar_file(tar, path, follow_symlink=True)
if path is None:
error(node, f'File "{file}" not found in tar')
_, real_path = get_tar_file(tar, path, follow_symlink=True)
if real_path is None:
error(node, f'File "{path}" not found in tar')
return None

content = tar.extractfile(path)
content = tar.extractfile(real_path)
config = configparser.ConfigParser()
config.read_string(content.read().decode())

Expand Down
Loading