Skip to content

Commit 0979c88

Browse files
committed
Replaced MIN length with MAX length
1 parent 59781ba commit 0979c88

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

plain2code_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
from typing import Optional
33

44
#
5-
MIN_BASE64_BLOB_LENGTH = 8192
5+
MAX_BASE64_BLOB_LENGTH = 8192
66

77
# Matches a long contiguous base64 / base64url run, optionally preceded by a data: URI header.
88
_BASE64_BLOB_PATTERN = re.compile(
9-
r"(?:data:[\w.+-]+/[\w.+-]+;base64,)?[A-Za-z0-9+/_-]{%d,}={0,2}" % MIN_BASE64_BLOB_LENGTH
9+
r"(?:data:[\w.+-]+/[\w.+-]+;base64,)?[A-Za-z0-9+/_-]{%d,}={0,2}" % MAX_BASE64_BLOB_LENGTH
1010
)
1111

1212

tests/test_file_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from file_utils import load_linked_resources, store_response_files
77
from plain2code_exceptions import UnsupportedBase64Content, UnsupportedResourceType
8-
from plain2code_utils import MIN_BASE64_BLOB_LENGTH
8+
from plain2code_utils import MAX_BASE64_BLOB_LENGTH
99

1010

1111
@pytest.fixture
@@ -45,7 +45,7 @@ def test_load_linked_resources_missing_file_raises_file_not_found(template_dir):
4545
def test_load_linked_resources_base64_blob_raises(template_dir):
4646
file_path = os.path.join(template_dir, "request.txt")
4747
with open(file_path, "w") as f:
48-
f.write("curl -d 'selfie_image=" + "A" * (MIN_BASE64_BLOB_LENGTH + 100) + "'")
48+
f.write("curl -d 'selfie_image=" + "A" * (MAX_BASE64_BLOB_LENGTH + 100) + "'")
4949

5050
with pytest.raises(UnsupportedBase64Content) as exc_info:
5151
load_linked_resources([template_dir], [{"text": "Request", "target": "request.txt"}], "my_thing")
@@ -57,7 +57,7 @@ def test_load_linked_resources_base64_blob_raises(template_dir):
5757
def test_load_linked_resources_small_base64_allowed(template_dir):
5858
file_path = os.path.join(template_dir, "token.txt")
5959
with open(file_path, "w") as f:
60-
f.write("token=" + "A" * (MIN_BASE64_BLOB_LENGTH - 100))
60+
f.write("token=" + "A" * (MAX_BASE64_BLOB_LENGTH - 100))
6161

6262
result = load_linked_resources([template_dir], [{"text": "Token", "target": "token.txt"}], "my_thing")
6363

0 commit comments

Comments
 (0)