sfx2/source/doc/docfile.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
New commits: commit d22a6842cf2e6b7763c52ba5121fc76c916fe7b5 Author: Justin Luth <[email protected]> AuthorDate: Thu Jul 13 20:44:26 2023 -0400 Commit: Mike Kaganski <[email protected]> CommitDate: Sat Jul 15 06:44:35 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 <[email protected]> (cherry picked from commit aaac643d4091e144ac05f74ad939b18d276be77d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154428 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
