This commit is contained in:
2026-01-12 23:30:21 -08:00
parent 3bd36baf5a
commit cef42cd54a

View File

@@ -1634,7 +1634,15 @@ class Add_File(Cmdlet):
c for c in title_value if c.isalnum() or c in " ._-()[]{}'`"
).strip()
base_name = safe_title or media_path.stem
new_name = base_name + media_path.suffix
# Fix to prevent double extensions (e.g., file.exe.exe)
# If the base name already ends with the extension of the media file,
# don't append it again.
file_ext = media_path.suffix
if file_ext and base_name.lower().endswith(file_ext.lower()):
new_name = base_name
else:
new_name = base_name + file_ext
destination_root.mkdir(parents=True, exist_ok=True)
target_path = destination_root / new_name