sfx2/source/doc/docmacromode.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 86373552318c4858b8a050d08c57dcb35cdb2193
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jan 2 07:41:46 2023 +0000
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Jan 2 12:23:35 2023 +0000

    Only call getDocumentLocation once
    
    Change-Id: I0d611e5170b392a6f2b78fda51e48cd1a3287fa7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144909
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index c2ec2fd8e417..ae70c6a8c056 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -206,12 +206,13 @@ namespace sfx2
         if ( nMacroExecutionMode == MacroExecMode::ALWAYS_EXECUTE_NO_WARN )
             return true;
 
+        const OUString sURL(m_xData->m_rDocumentAccess.getDocumentLocation());
         try
         {
             // get document location from medium name and check whether it is 
a trusted one
             // the service is created without document version, since it is 
not of interest here
             Reference< XDocumentDigitalSignatures > 
xSignatures(DocumentDigitalSignatures::createDefault(::comphelper::getProcessComponentContext()));
-            INetURLObject aURLReferer( 
m_xData->m_rDocumentAccess.getDocumentLocation() );
+            INetURLObject aURLReferer(sURL);
 
             OUString aLocation;
             if ( aURLReferer.removeSegment() )
@@ -293,7 +294,6 @@ namespace sfx2
 #if defined(_WIN32)
         // Windows specific: try to decide macros loading depending on Windows 
Security Zones
         // (is the file local, or it was downloaded from internet, etc?)
-        OUString sURL(m_xData->m_rDocumentAccess.getDocumentLocation());
         OUString sFilePath;
         osl::FileBase::getSystemPathFromFileURL(sURL, sFilePath);
         sal::systools::COMReference<IZoneIdentifier> pZoneId;
@@ -348,7 +348,7 @@ namespace sfx2
 
         if ( eAutoConfirm == eNoAutoConfirm )
         {
-            OUString sReferrer( 
m_xData->m_rDocumentAccess.getDocumentLocation() );
+            OUString sReferrer(sURL);
 
             OUString aSystemFileURL;
             if ( osl::FileBase::getSystemPathFromFileURL( sReferrer, 
aSystemFileURL ) == osl::FileBase::E_None )

Reply via email to