diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-05-07 12:03:48 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-06-23 16:06:55 +0200 |
commit | 29cb36cbee9c3ff5e73bc7a6d6a2f365c5c62da7 (patch) | |
tree | b59136ff8a317c22c1b63e5b5ab34e14c8e0bd09 /dbaccess | |
parent | 5ed96c798679a1613b058a11b30cce4ba0ffd920 (diff) |
tdf#97694 Add test for macro signature preservation in Base
Change-Id: I35fb8d499eed66f9a5e208a4778a1f0f12637079
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93630
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/ModelImpl.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 2fae3b051ba6..e54712ff9ae5 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -848,14 +848,17 @@ bool ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference< aTempFile.EnableKillingFile(); OUString sTmpFileUrl = aTempFile.GetURL(); SignatureState aSignatureState = getScriptingSignatureState(); - if (aSignatureState == SignatureState::OK - || aSignatureState == SignatureState::NOTVALIDATED - || aSignatureState == SignatureState::INVALID) + OUString sLocation = getDocFileLocation(); + bool bIsEmbedded = sLocation.startsWith("vnd.sun.star.pkg:") && sLocation.endsWith("/EmbeddedDatabase"); + if (!bIsEmbedded && !sLocation.isEmpty() + && (aSignatureState == SignatureState::OK || aSignatureState == SignatureState::NOTVALIDATED + || aSignatureState == SignatureState::INVALID + || aSignatureState == SignatureState::UNKNOWN)) { bTryToPreserveScriptSignature = true; // We need to first save the file (which removes the macro signature), then add the macro signature again. // For that, we need a temporary copy of the original file. - osl::File::RC rc = osl::File::copy(getDocFileLocation(), sTmpFileUrl); + osl::File::RC rc = osl::File::copy(sLocation, sTmpFileUrl); if (rc != osl::FileBase::E_None) throw uno::RuntimeException("Could not create temp file"); } |