your commit message
This commit is contained in:
@@ -44,6 +44,13 @@ SUPPORTED_MEDIA_EXTENSIONS = ALL_SUPPORTED_EXTENSIONS
|
||||
|
||||
DEBUG_PIPE_NOTE_PREVIEW_LENGTH = 256
|
||||
|
||||
# Protocol schemes that identify a remote resource / not a local file path.
|
||||
# Used by multiple methods in this file to guard against URL strings being
|
||||
# treated as local file paths.
|
||||
_REMOTE_URL_PREFIXES: tuple[str, ...] = (
|
||||
"http://", "https://", "magnet:", "torrent:", "tidal:", "hydrus:",
|
||||
)
|
||||
|
||||
|
||||
def _truncate_debug_note_text(value: Any) -> str:
|
||||
raw = str(value or "")
|
||||
@@ -1203,7 +1210,7 @@ class Add_File(Cmdlet):
|
||||
|
||||
if candidate:
|
||||
s = str(candidate).lower()
|
||||
if s.startswith(("http://", "https://", "magnet:", "torrent:", "tidal:", "hydrus:")):
|
||||
if s.startswith(_REMOTE_URL_PREFIXES):
|
||||
log("add-file ingests local files only. Use download-file first.", file=sys.stderr)
|
||||
return None, None, None
|
||||
|
||||
@@ -1427,7 +1434,7 @@ class Add_File(Cmdlet):
|
||||
if not val:
|
||||
return False
|
||||
# Obvious schemes
|
||||
if val.startswith(("http://", "https://", "magnet:", "torrent:", "tidal:", "hydrus:")):
|
||||
if val.startswith(_REMOTE_URL_PREFIXES):
|
||||
return True
|
||||
# Domain-like patterns or local file paths (but we want URLs here)
|
||||
if "://" in val:
|
||||
|
||||
Reference in New Issue
Block a user