This commit is contained in:
2026-01-14 22:21:19 -08:00
parent 5d63777dee
commit ac10e607bb
3 changed files with 95 additions and 68 deletions

View File

@@ -546,7 +546,7 @@ class Add_File(Cmdlet):
delete_after_item = delete_after
try:
if use_steps and (not steps_started):
progress.begin_steps(4)
progress.begin_steps(5)
progress.step("resolving source")
steps_started = True
@@ -560,6 +560,19 @@ class Add_File(Cmdlet):
failures += 1
continue
if use_steps and steps_started:
progress.step("hashing file")
# Update pipe_obj with resolved path
pipe_obj.path = str(media_path)
# When using -path (filesystem export), allow all file types.
# When using -store (backend), restrict to SUPPORTED_MEDIA_EXTENSIONS.
allow_all_files = not (location and is_storage_backend_location)
if not self._validate_source(media_path, allow_all_extensions=allow_all_files):
failures += 1
continue
if use_steps and steps_started and (not step2_done):
progress.step("ingesting file")
step2_done = True
@@ -1973,16 +1986,18 @@ class Add_File(Cmdlet):
debug("[add-file] Deferring tag application until after Hydrus upload")
debug(
f"[add-file] Storing into backend '{backend_name}' path='{media_path}' title='{title}'"
f"[add-file] Storing into backend '{backend_name}' path='{media_path}' title='{title}' hash='{f_hash[:12] if f_hash else 'N/A'}'"
)
# Call backend's add_file with full metadata
# Backend returns hash as identifier
# Backend returns hash as identifier. If we already know the hash from _resolve_source
# (which came from download-file emit), pass it to skip re-hashing the 4GB file.
file_identifier = backend.add_file(
media_path,
title=title,
tag=upload_tags,
url=[] if (defer_url_association and url) else url,
file_hash=f_hash,
)
debug(
f"[add-file] backend.add_file returned identifier {file_identifier} (len={len(str(file_identifier)) if file_identifier is not None else 'None'})"