Video Crop + Rotate + Pad (Frame and Clip): Server file mode read a whole path that had to lie inside ComfyUI's input, output or temp folder. It now takes the folder and the name (output/clip.mp4) and joins them below that folder. A whole path, a drive, "~", ".." and a network path are refused from the text alone, and a link that leads out is refused once the path is resolved. The hint under the field says what to type when a whole path is in it. LoRA Loader: the preview route sends a small JPEG made from the picture beside the LoRA instead of the file itself. resolve_input_path refuses when ComfyUI's folders are missing instead of opening the name unchecked. A route's error text that names a place on the server's disk is replaced whole (nodes/_route_errors.py), on the LoRA routes too.
19 lines
678 B
Python
19 lines
678 B
Python
"""What a route says back when a request fails."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
|
|
# A whole path: a word that opens with "/", "\" or a drive letter.
|
|
_SERVER_PATH = re.compile(r"""(?:^|[\s'"(\[=:,;])(?:[A-Za-z]:[\\/]|[\\/])[^\s'"]""")
|
|
|
|
|
|
def safe_route_error(exc: Exception, fallback: str = "The request failed.") -> str:
|
|
"""The error text for the caller. A message that names a place on the
|
|
server's disk is replaced whole: a decoder or the system quotes the file
|
|
it was given, and the routes answer anyone who can reach the server."""
|
|
text = str(exc).strip()
|
|
if not text or _SERVER_PATH.search(text):
|
|
return fallback
|
|
return text
|