Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.
Redact Windows paths with spaces and shares in download source reasons
Bowen Xue79edaff06ba0
diff --git a/freevideo_engine/diagnostics.py b/freevideo_engine/diagnostics.pyindex dedd74b..b33fa14 100644--- a/freevideo_engine/diagnostics.py+++ b/freevideo_engine/diagnostics.py@@ -17,6 +17,7 @@ import zipfileimport platformfrom . import execution_paths+from . import long_pathsfrom .long_paths import io_path, resolved, plain, plain_textfrom . import __version__from .bootstrap import DEFAULT_ROOT@@ -38,16 +39,8 @@ SENSITIVE = re.compile(r'(?:^|[_-])(?:token|password|secret|credential|api[_-]?k# elsewhere, so replacing only the current installation root is insufficient.PATH_KEYS = frozenset(('base', 'checkpoint', 'encoder', 'output', 'directory','retained', 'sample_csv', 'path', 'root', 'command'))-ABSOLUTE_PATH = re.compile(- # The preceding character guard prevents URL slashes from being treated- # as local paths while still matching a drive path after prose such as- # ``at C:\\Users\\...`` or a quoted traceback location. A slash followed by- # whitespace is prose (``8.0 / SM80``), not the start of a path.- # Consume explicit relative paths too, spaces included, so an interior- # slash (after e.g. a hyphen) cannot subsequently be mistaken for an- # absolute path. Only our own ``./setup.sh`` command stays as written.- r'''(?<![A-Za-z0-9_:/])(?:(?P<command>\./setup\.sh(?![\w/\\-]|\.\w))|\.{1,2}/[^"'<>;\r\n,\)\]}]*|'''- r'''(?:(?:[A-Za-z]:[\\/])|(?:\\\\[^\\/\s"'<>]+[\\/])|/(?![/\s]))[^"'<>;\r\n,\)\]}]*)''')+# Shared with the download error text, which is redacted before it reaches a report.+ABSOLUTE_PATH = long_paths.ABSOLUTE_PATHclass Redactor:@@ -99,28 +92,16 @@ class Redactor:value = ABSOLUTE_PATH.sub(self._path_match, value)return value- @classmethod- def _path_match(cls, match):- value = match.group(0)- if match.group('command') is not None:- return value- # Text is often redacted again (a worker's log inside a report, the- # launcher terminal). The ``/name`` after an earlier ``<PATH>`` is that- # pass's own output, unless it still has a directory in it.- if match.string.endswith('<PATH>', 0, match.start()) and not re.search(r'[\\/]', value[1:].rstrip('\\/')):- return value- return cls._path_placeholder(value)+ @staticmethod+ def _path_match(match):+ return long_paths.path_match(match)@staticmethoddef _path_key(key):lowered = str(key).lower()return lowered in PATH_KEYS or lowered.endswith(('_path', '_paths', '_dir', '_root', '_report'))- @staticmethod- def _path_placeholder(value):- normalized = str(value).rstrip('\\/')- name = re.split(r'[\\/]', normalized)[-1]- return '<PATH>/' + name if name else '<PATH>'+ _path_placeholder = staticmethod(long_paths.path_placeholder)def path(self, value):"""Return a slash-normalized relative path safe for a shared report."""diff --git a/freevideo_engine/failure_details.py b/freevideo_engine/failure_details.pyindex ba740e2..cb4a99f 100644--- a/freevideo_engine/failure_details.py+++ b/freevideo_engine/failure_details.py@@ -439,7 +439,10 @@ def launcher_failure(value, *, zh=False, **options):text, lines = _sources_block(str(value)) if value else ('', [])if not lines:return _launcher_failure(value, zh=zh, **options)- # The source lines never change which guidance applies.+ # The source lines never change which guidance applies, except a full disk:+ # no other source can help, so the card keeps the disk space guidance.+ if any((found := _SOURCE_LINE.match(line)) and found['cls'] == 'disk-full' for line in lines):+ text += '\nNot enough disk space'failure = _launcher_failure(text, zh=zh, **options)sources = source_lines(lines, zh)if sources:diff --git a/freevideo_engine/long_paths.py b/freevideo_engine/long_paths.pyindex 4fc07d3..3f3bb83 100644--- a/freevideo_engine/long_paths.py+++ b/freevideo_engine/long_paths.py@@ -232,3 +232,35 @@ def plain_errors(function):def path_chars(path):"""Windows budgets count UTF-16 code units (a non-BMP character uses two)."""return len(str(path).encode('utf-16-le', errors='surrogatepass')) // 2+++ABSOLUTE_PATH = re.compile(+ # The preceding character guard prevents URL slashes from being treated+ # as local paths while still matching a drive path after prose such as+ # ``at C:\\Users\\...`` or a quoted traceback location. A slash followed by+ # whitespace is prose (``8.0 / SM80``), not the start of a path.+ # Consume explicit relative paths too, spaces included, so an interior+ # slash (after e.g. a hyphen) cannot subsequently be mistaken for an+ # absolute path. Only our own ``./setup.sh`` command stays as written.+ r'''(?<![A-Za-z0-9_:/])(?:(?P<command>\./setup\.sh(?![\w/\\-]|\.\w))|\.{1,2}/[^"'<>;\r\n,\)\]}]*|'''+ r'''(?:(?:[A-Za-z]:[\\/])|(?:\\\\[^\\/\s"'<>]+[\\/])|/(?![/\s]))[^"'<>;\r\n,\)\]}]*)''')+++def path_placeholder(value):+ """``<PATH>/`` and the last component: no usernames, drives, shares or parent directories."""+ normalized = str(value).rstrip('\\/')+ name = re.split(r'[\\/]', normalized)[-1]+ return '<PATH>/' + name if name else '<PATH>'+++def path_match(match):+ """Replacement for an ``ABSOLUTE_PATH`` match. Spaces, UNC shares and ``\\\\?\\`` prefixes count."""+ value = match.group(0)+ if match.group('command') is not None:+ return value+ # Text is often redacted again (a worker's log inside a report, the+ # launcher terminal). The ``/name`` after an earlier ``<PATH>`` is that+ # pass's own output, unless it still has a directory in it.+ if match.string.endswith('<PATH>', 0, match.start()) and not re.search(r'[\\/]', value[1:].rstrip('\\/')):+ return value+ return path_placeholder(value)diff --git a/freevideo_engine/network.py b/freevideo_engine/network.pyindex 734a84b..9926709 100644--- a/freevideo_engine/network.py+++ b/freevideo_engine/network.py@@ -24,7 +24,7 @@ import threadingimport timefrom urllib.parse import quote, unquote, urlencode, urljoin, urlsplitfrom . import proxy-from .long_paths import io_path, is_windows, path_chars, plain, plain_errors+from .long_paths import io_path, is_windows, path_chars, plain, plain_errors, ABSOLUTE_PATH, path_matchfrom .system import curl_executable, curl_ca_arguments, missing_curl_message, windows@@ -573,20 +573,29 @@ def _redact(value):if isinstance(value, bytes):value = value.decode('utf-8', errors='replace')value = _ANSI_ESCAPE.sub('', str(value)).replace('\x00', '')- # User information in any URL (https, socks5, a token alone before @).- value = re.sub(r'(?i)\b([a-z][a-z0-9+.-]*://)[^\s/@\x27\x22]+@', r'\1<REDACTED>@', value)+ # User information in any URL (https, socks5, a token alone before @), up to+ # the last @ before the host, so a password holding an @ goes as a whole.+ value = re.sub(r'(?i)\b([a-z][a-z0-9+.-]*://)[^\s/\x27\x22]+@', r'\1<REDACTED>@', value)+ # A proxy written without a scheme: user:password@host[:port].+ value = re.sub(r'(?<![^\s\x27\x22(=,;])[^\s/:@\x27\x22]+:[^\s/\x27\x22]*@(?=[A-Za-z0-9[])', '<REDACTED>@', value)# Query strings routinely carry signed URLs and access tokens.value = re.sub(r'(?i)(https?://[^\s?\x27\x22]+)\?[^\s\x27\x22]+', r'\1', value)- value = re.sub(r'(?i)(Bearer\s+)[A-Za-z0-9._~+/-]+', r'\1<REDACTED>', value)+ value = re.sub(r'(?i)(\b(?:Bearer|Basic)\s+)[A-Za-z0-9._~+/=-]+', r'\1<REDACTED>', value)+ # Hugging Face, GitHub and API keys, wherever they appear (a URL path, a header).+ value = re.sub(r'\b(?:hf_|sk-|gh[pousr]_|github_pat_)[A-Za-z0-9_-]{8,}\b', '<REDACTED>', value)value = re.sub(r'(?i)(\b[\w-]{0,64}(?:token|password|secret|api[_-]?key)\s*[=:]\s*)[^\s,;&]+',r'\1<REDACTED>', value)- # Keep a stable path marker without exposing usernames, drives or mounts.+ # Keep a stable path marker without exposing usernames, drives, shares or+ # mounts; spaces, UNC and \\?\ paths included, as in a diagnostic report.# A marker already in place stays as it is, so redacting twice changes nothing.- return re.sub(r'(?<![A-Za-z0-9_:/>])(?:(?P<relative>\.{1,2}/[^\s"\'<>;,)\]}]*)|'- r'(?:[A-Za-z]:[\\/]|/)([^\s"\'<>;,)\]}]*))',- lambda match: match.group('relative') if match.group('relative') is not None- and not re.search(r'[\\/]', match.group('relative').split('/', 1)[1]) else- '<PATH>/' + re.split(r'[\\/]', match.group(0).rstrip('\\/'))[-1], value)+ return ABSOLUTE_PATH.sub(_path_match, value)+++def _path_match(match):+ # The rest of a URL whose token was removed (``.../<REDACTED>/file``).+ if match.string.endswith('<REDACTED>', 0, match.start()) and not re.search(r'[\\/]', match.group(0)[1:]):+ return match.group(0)+ return path_match(match)def _package_failure(error):@@ -662,6 +671,8 @@ def exit_code(error):def failure_reason(error):"""(class, one short redacted line) for a failed source attempt."""text = error if isinstance(error, str) else (getattr(error, 'stderr', None) or getattr(error, 'stdout', None) or str(error))+ if isinstance(text, (bytes, bytearray)):+ text = bytes(text).decode('utf-8', errors='replace')head, _, output = str(text).partition('\n\nFull step output:\n')lines = [line.strip() for line in _redact(output or head).splitlines() if line.strip()]returncode = exit_code(error)diff --git a/web/error_panel.js b/web/error_panel.jsindex 5ef882a..806f953 100644--- a/web/error_panel.js+++ b/web/error_panel.js@@ -234,8 +234,12 @@ function reportRedactor(detail, context) {.replace(/\b(?:\d{1,3}\.){3}\d{1,3}\b/g, '<ADDRESS REMOVED>');// Keep traceback source basenames and line numbers, never drive names,// home directories or private media filenames. Spaces in paths count.- text = text.replace(/(^|[^A-Za-z0-9_:/<>])(\.\/setup\.sh(?![\w\/\\-]|\.\w)|\.{1,2}\/[^\r\n"'<>;,\)\]]*|(?:[A-Za-z]:[\\/]|\\\\[^\\/\s]+[\\/]|\/(?![\/\s]))[^\r\n"'<>;,\)\]]+)/gm, (_, prefix, path) => {+ // The engine may have redacted the text already: what follows its own+ // <PATH> marker stays when it is one name, and goes when it is the rest+ // of a path (a user name with a space, a share).+ text = text.replace(/(^|[^A-Za-z0-9_:/<])(\.\/setup\.sh(?![\w\/\\-]|\.\w)|\.{1,2}\/[^\r\n"'<>;,\)\]]*|(?:[A-Za-z]:[\\/]|\\\\[^\\/\s]+[\\/]|\/(?![\/\s]))[^\r\n"'<>;,\)\]]+)/gm, (_, prefix, path, offset, whole) => {if (path === './setup.sh') return prefix + path;+ if (prefix === '>' && whole.slice(0, offset + 1).endsWith('<PATH>') && !/[\\/]/.test(path.slice(1))) return prefix + path;const source = path.replace(/\\/g, '/').match(/\/([A-Za-z0-9_.-]+\.(?:py|js|ts|mjs))(?=[:\s]|$)/);return prefix + (source ? '<PATH>/' + source[1] + path.slice(path.indexOf(source[1]) + source[1].length) : '<PATH REMOVED>');});