[text] reject long filename extensions (#8491)

fixes regression introduced in 3252ead7c7
ref bc868e7bb8
This commit is contained in:
Mike Fährmann
2025-11-01 10:34:11 +01:00
parent 3848a912dc
commit 37aa7337dc
3 changed files with 16 additions and 1 deletions

View File

@@ -228,6 +228,10 @@ class TestText(unittest.TestCase):
{"filename": "foo%202?bar&<>", "extension": "ext"},
)
# long "extension"
fn = "httpswww.example.orgpath-path-path-path-path-path-path-path"
self.assertEqual(f(fn), {"filename": fn, "extension": ""})
def test_extract(self, f=text.extract):
txt = "<a><b>"
self.assertEqual(f(txt, "<", ">"), ("a" , 3))