This commit is contained in:
2026-03-04 18:22:35 -08:00
parent f103496a00
commit a29d7508ec
2 changed files with 9 additions and 6 deletions

View File

@@ -1150,18 +1150,18 @@ class Add_File(Cmdlet):
Returns (media_path, file_hash, temp_dir_to_cleanup).
"""
# PRIORITY 1a: Try hash+path from directory scan result
# PRIORITY 1a: Prefer an explicit local path when it exists.
# This avoids unnecessary backend.get_file(hash) probes (and remote fallbacks)
# for freshly downloaded temp files that are not yet present in the source store.
if isinstance(result, dict):
r_path = result.get("path")
r_hash = result.get("hash")
r_store = result.get("store")
# If we have path+hash but no store, it's likely a dir scan result
if r_path and r_hash and not r_store:
if r_path:
try:
p = coerce_to_path(r_path)
if p.exists() and p.is_file():
pipe_obj.path = str(p)
return p, str(r_hash), None
return p, str(r_hash) if r_hash else None, None
except Exception:
pass