j
This commit is contained in:
@@ -972,8 +972,30 @@ class Add_File(Cmdlet):
|
||||
|
||||
tmp_dir: Optional[Path] = None
|
||||
try:
|
||||
# Extract suffix from pipe_obj path to avoid .tmp rejections
|
||||
suffix = None
|
||||
if pipe_obj.path:
|
||||
try:
|
||||
suffix = Path(pipe_obj.path).suffix
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Extract suffix from metadata if available (fallback)
|
||||
if not suffix:
|
||||
metadata = getattr(pipe_obj, "metadata", {})
|
||||
if isinstance(metadata, dict):
|
||||
suffix = metadata.get("ext")
|
||||
|
||||
tmp_dir = Path(tempfile.mkdtemp(prefix="add-file-src-"))
|
||||
downloaded = downloader(str(file_hash), temp_root=tmp_dir)
|
||||
|
||||
# Pass suffix to downloader if it supports it
|
||||
import inspect
|
||||
sig = inspect.signature(downloader)
|
||||
if "suffix" in sig.parameters:
|
||||
downloaded = downloader(str(file_hash), temp_root=tmp_dir, suffix=suffix)
|
||||
else:
|
||||
downloaded = downloader(str(file_hash), temp_root=tmp_dir)
|
||||
|
||||
if isinstance(downloaded, Path) and downloaded.exists():
|
||||
pipe_obj.is_temp = True
|
||||
return downloaded, tmp_dir
|
||||
|
||||
Reference in New Issue
Block a user