From d0c925f6c8779a2f2dc4f149c2e7d13f0ab2eb97 Mon Sep 17 00:00:00 2001 From: red person Date: Tue, 2 Jun 2026 14:55:30 +0300 Subject: [PATCH] Chat attachments: allow picker to choose any file type --- static/index.html | 2 +- tests/test_chat_attachment_picker.py | 33 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/test_chat_attachment_picker.py diff --git a/static/index.html b/static/index.html index 55aa79e..6ed0769 100644 --- a/static/index.html +++ b/static/index.html @@ -981,7 +981,7 @@ - +
diff --git a/tests/test_chat_attachment_picker.py b/tests/test_chat_attachment_picker.py new file mode 100644 index 0000000..c274aef --- /dev/null +++ b/tests/test_chat_attachment_picker.py @@ -0,0 +1,33 @@ +from html.parser import HTMLParser +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] + + +class _InputParser(HTMLParser): + def __init__(self): + super().__init__() + self.inputs = {} + + def handle_starttag(self, tag, attrs): + if tag != "input": + return + attr_map = dict(attrs) + input_id = attr_map.get("id") + if input_id: + self.inputs[input_id] = attr_map + + +def _inputs(): + parser = _InputParser() + parser.feed((ROOT / "static" / "index.html").read_text(encoding="utf-8")) + return parser.inputs + + +def test_chat_attachment_picker_allows_any_file_type(): + file_input = _inputs()["file-input"] + + assert file_input["type"] == "file" + assert "multiple" in file_input + assert "accept" not in file_input