diff --git a/backend/packages/harness/deerflow/utils/AGENTS.md b/backend/packages/harness/deerflow/utils/AGENTS.md index f7f79f588..0bc17cbca 100644 --- a/backend/packages/harness/deerflow/utils/AGENTS.md +++ b/backend/packages/harness/deerflow/utils/AGENTS.md @@ -18,3 +18,10 @@ Tool and agent assembly re-enters `get_available_tools()` and may block on MCP d optional leading UTF-8 BOM cannot hide a first-line heading or code fence, or occupy a preview line. Preserve physical line numbers, embedded U+FEFF characters, and the original file bytes. + +### Active Content MIME Types + +`text_detection.py::_is_active_content_mime_type` is the shared download-safety +boundary for artifacts and project documents. Keep platform aliases such as +Windows' `image/svg` aligned with their standard active type (`image/svg+xml`), +and preserve the generic `+xml` rule. diff --git a/backend/packages/harness/deerflow/utils/text_detection.py b/backend/packages/harness/deerflow/utils/text_detection.py index e74f4df8a..83a9ce662 100644 --- a/backend/packages/harness/deerflow/utils/text_detection.py +++ b/backend/packages/harness/deerflow/utils/text_detection.py @@ -16,11 +16,12 @@ def is_text_file_by_content(path: Path, sample_size: int = 8192) -> bool: return False -# Exact matches only; ``_is_active_content_mime_type`` also treats every +# Exact matches include platform MIME aliases; the helper also treats every # ``+xml`` subtype as active content. ACTIVE_CONTENT_MIME_TYPES = { "text/html", "application/xhtml+xml", + "image/svg", "image/svg+xml", "text/xml", "application/xml", @@ -32,10 +33,10 @@ def _is_active_content_mime_type(mime_type: str | None) -> bool: """Return whether a browser can run script when rendering *mime_type* inline. Beyond HTML, this covers every WHATWG XML MIME type (``text/xml``, - ``application/xml``, or a ``+xml`` subtype) plus ``text/xsl``, which Blink - also renders as XML: any XML document can carry an XHTML-namespaced - ``