Fix T85688: ExportHelper adds multiple file name extensions

Replace the existing extension instead of adding it.
This commit is contained in:
Campbell Barton 2021-04-28 22:53:35 +10:00
parent 718109e7f0
commit 0b6892f0ba
Notes: blender-bot 2023-02-14 06:37:09 +01:00
Referenced by issue #85688, ExportHelper: filename_ext change is appended to the previous name + ext instead of changing ext
1 changed files with 5 additions and 7 deletions

View File

@ -94,13 +94,11 @@ class ExportHelper:
if check_extension is not None:
filepath = self.filepath
if os.path.basename(filepath):
filepath = bpy.path.ensure_ext(
filepath,
self.filename_ext
if check_extension
else "",
)
if check_extension:
filepath = bpy.path.ensure_ext(
os.path.splitext(filepath)[0],
self.filename_ext,
)
if filepath != self.filepath:
self.filepath = filepath
change_ext = True