[Bf-blender-cvs] [0b6892f0ba1] blender-v2.93-release: Fix T85688: ExportHelper adds multiple file name extensions

Campbell Barton noreply at git.blender.org
Wed Apr 28 15:02:02 CEST 2021


Commit: 0b6892f0ba114e6b3dfd40aac2727b4b1efacb66
Author: Campbell Barton
Date:   Wed Apr 28 22:53:35 2021 +1000
Branches: blender-v2.93-release
https://developer.blender.org/rB0b6892f0ba114e6b3dfd40aac2727b4b1efacb66

Fix T85688: ExportHelper adds multiple file name extensions

Replace the existing extension instead of adding it.

===================================================================

M	release/scripts/modules/bpy_extras/io_utils.py

===================================================================

diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py
index 19697b25f70..7eb9b2aa347 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -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



More information about the Bf-blender-cvs mailing list