f
This commit is contained in:
@@ -1634,7 +1634,15 @@ class Add_File(Cmdlet):
|
|||||||
c for c in title_value if c.isalnum() or c in " ._-()[]{}'`"
|
c for c in title_value if c.isalnum() or c in " ._-()[]{}'`"
|
||||||
).strip()
|
).strip()
|
||||||
base_name = safe_title or media_path.stem
|
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)
|
destination_root.mkdir(parents=True, exist_ok=True)
|
||||||
target_path = destination_root / new_name
|
target_path = destination_root / new_name
|
||||||
|
|||||||
Reference in New Issue
Block a user