sfx2/source/doc/docfile.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit b6f3129569c22d9d139ca712dcf0db6dc2041565
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Thu Jul 13 20:44:26 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Fri Jul 14 15:03:10 2023 +0200

    tdf#143038: preserve extension on backup file
    
    This allows knowing what kind of backup this is,
    as well as allowing the same named document
    for every kind of file format to be retained in backup.
    
    Change-Id: Iff22802d73adad351cb129b402db7567f0af7c7d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154407
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index d9379866deaa..0f14c4869207 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2664,7 +2664,9 @@ void SfxMedium::DoBackup_Impl()
             // save as ".bak" file
             INetURLObject aDest( aBakDir );
             aDest.insertName( aSource.getName() );
-            aDest.setExtension( u"bak" );
+            const OUString sExt
+                = aSource.hasExtension() ? aSource.getExtension() + ".bak" : 
OUString("bak");
+            aDest.setExtension(sExt);
             OUString aFileName = aDest.getName( INetURLObject::LAST_SEGMENT, 
true, INetURLObject::DecodeMechanism::WithCharset );
 
             // create a content for the source file

Reply via email to