From 19f8e1ca74fc20ecb2d9f79591c761113e470f9a Mon Sep 17 00:00:00 2001 From: uncle-lv Date: Fri, 23 Jan 2026 13:03:01 +0000 Subject: [PATCH 1/3] fix validation info --- src/flask_marshmallow/validate.py | 2 +- tests/test_validate.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/flask_marshmallow/validate.py b/src/flask_marshmallow/validate.py index eee586c..d54a208 100644 --- a/src/flask_marshmallow/validate.py +++ b/src/flask_marshmallow/validate.py @@ -180,7 +180,7 @@ def __init__( def _format_error(self, value): return (self.error or self.default_message).format( - input=value, extensions="".join(self.allowed_types) + input=value, extensions=",".join(self.allowed_types) ) def __call__(self, value): diff --git a/tests/test_validate.py b/tests/test_validate.py index a9ceec1..f64a8dc 100644 --- a/tests/test_validate.py +++ b/tests/test_validate.py @@ -1,4 +1,5 @@ import io +import re from tempfile import SpooledTemporaryFile import pytest @@ -162,7 +163,7 @@ def test_filetype(): with pytest.raises( ValidationError, - match=r"Not an allowed file type. Allowed file types: \[.*?\]", # noqa: W605 + match=re.escape("Not an allowed file type. Allowed file types: [.png,.jpg]"), # noqa: W605 ): no_ext_fs = FileStorage(io.BytesIO(b"".ljust(1024)), "test") - validate.FileType([".png"])(no_ext_fs) + validate.FileType([".png", ".jpg"])(no_ext_fs) From c4dfbe83bfc27cb957044d8345bcf15fa13ef3f8 Mon Sep 17 00:00:00 2001 From: uncle-lv Date: Fri, 23 Jan 2026 13:24:18 +0000 Subject: [PATCH 2/3] fix test --- tests/test_validate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_validate.py b/tests/test_validate.py index f64a8dc..bb70d93 100644 --- a/tests/test_validate.py +++ b/tests/test_validate.py @@ -1,5 +1,4 @@ import io -import re from tempfile import SpooledTemporaryFile import pytest @@ -163,7 +162,7 @@ def test_filetype(): with pytest.raises( ValidationError, - match=re.escape("Not an allowed file type. Allowed file types: [.png,.jpg]"), # noqa: W605 + match=r"Not an allowed file type. Allowed file types: \[.*?\]", # noqa: W605 ): no_ext_fs = FileStorage(io.BytesIO(b"".ljust(1024)), "test") validate.FileType([".png", ".jpg"])(no_ext_fs) From f79022e1830feaac98aed9eef46b5225005042fb Mon Sep 17 00:00:00 2001 From: Steven Loria Date: Wed, 4 Feb 2026 10:56:11 -0500 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f1781c7..98f77dd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Changelog ========= +unreleased +********** + +Bug fixes: + +* Add missing commas in error message for ``validate.FileType`` (:pr:`374`). + 1.3.0 (2025-01-06) ******************