Skip to content

Commit 4368ee2

Browse files
committed
Working validator
1 parent 99d62a3 commit 4368ee2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/mock_vws/_mock_web_query_api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,12 @@ def validate_image_file_size(
106106

107107
image_file = io.BytesIO(image)
108108
pil_image = Image.open(image_file)
109-
file_size_bytes = len(pil_image.tobytes())
110109

111110
if pil_image.format != 'PNG':
112111
return wrapped(*args, **kwargs)
113112

114113
documented_max_png_bytes = 2 * 1024 * 1024
115-
if file_size_bytes > documented_max_png_bytes:
114+
if len(image) > documented_max_png_bytes:
116115
raise requests.exceptions.ConnectionError
117116
return wrapped(*args, **kwargs)
118117

0 commit comments

Comments
 (0)