33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
# Copyright (c) 2026 PowerOn AG
|
|
# All rights reserved.
|
|
"""Heuristics for hiding internal workflow artefacts from user-facing file lists."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Mapping, Optional
|
|
|
|
|
|
_WORKFLOW_INTERNAL_FILE_TAG = "_workflowInternal"
|
|
|
|
|
|
def suppressWorkflowFileInWorkspaceUi(meta: Optional[Mapping[str, Any]]) -> bool:
|
|
"""True when a file row should not appear in user-facing file lists.
|
|
|
|
Used by Automation Workspace **and** ``/api/files/list`` (Meine Dateien).
|
|
Matches persisted JSON handovers from transient runs (``extracted_content_transient*``),
|
|
internal extract image files (``extract_media_*``), the ``_workflowInternal`` tag, and
|
|
optional explicit flags.
|
|
"""
|
|
if not isinstance(meta, Mapping):
|
|
return False
|
|
tags = meta.get("tags")
|
|
if isinstance(tags, list) and _WORKFLOW_INTERNAL_FILE_TAG in tags:
|
|
return True
|
|
fn = str(meta.get("fileName") or "").lower()
|
|
if "extracted_content_transient" in fn:
|
|
return True
|
|
if "extract_media_" in fn:
|
|
return True
|
|
if meta.get("suppressInWorkflowFileLists") is True:
|
|
return True
|
|
return False
|