f13cc9a
From cd25a97bbadc0a5c1fd6b0e8603c8b6ebd051926 Mon Sep 17 00:00:00 2001
f13cc9a
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
f13cc9a
Date: Tue, 1 May 2018 12:57:02 +0100
f13cc9a
Subject: [PATCH] set Referer on link mediadescriptor
f13cc9a
f13cc9a
to allow determining if the source document is from a trusted/untrusted
f13cc9a
location
f13cc9a
f13cc9a
Change-Id: I780568652d2ef0cc8543c27ba26289277b5d9d0c
f13cc9a
Reviewed-on: https://gerrit.libreoffice.org/53693
f13cc9a
Tested-by: Jenkins <ci@libreoffice.org>
f13cc9a
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
f13cc9a
---
f13cc9a
 sw/source/filter/xml/xmltexti.cxx | 11 ++++++++---
f13cc9a
 1 file changed, 8 insertions(+), 3 deletions(-)
f13cc9a
f13cc9a
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
f13cc9a
index 78cab08507f0..33548de42f6c 100644
f13cc9a
--- a/sw/source/filter/xml/xmltexti.cxx
f13cc9a
+++ b/sw/source/filter/xml/xmltexti.cxx
f13cc9a
@@ -570,16 +570,21 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink(
f13cc9a
         uno::Sequence< beans::PropertyValue > aMediaDescriptor( 1 );
f13cc9a
         aMediaDescriptor[0].Name = "URL";
f13cc9a
         aMediaDescriptor[0].Value <<= aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
f13cc9a
-        if ( pDoc->GetDocShell() && pDoc->GetDocShell()->GetMedium() )
f13cc9a
+
f13cc9a
+        if (SfxMedium* pMedium = pDoc->GetDocShell() ? pDoc->GetDocShell()->GetMedium() : nullptr)
f13cc9a
         {
f13cc9a
-            uno::Reference< task::XInteractionHandler > xInteraction =
f13cc9a
-                                        pDoc->GetDocShell()->GetMedium()->GetInteractionHandler();
f13cc9a
+            uno::Reference< task::XInteractionHandler > xInteraction = pMedium->GetInteractionHandler();
f13cc9a
             if ( xInteraction.is() )
f13cc9a
             {
f13cc9a
                 aMediaDescriptor.realloc( 2 );
f13cc9a
                 aMediaDescriptor[1].Name = "InteractionHandler";
f13cc9a
                 aMediaDescriptor[1].Value <<= xInteraction;
f13cc9a
             }
f13cc9a
+
f13cc9a
+            const auto nLen = aMediaDescriptor.getLength() + 1;
f13cc9a
+            aMediaDescriptor.realloc(nLen);
f13cc9a
+            aMediaDescriptor[nLen - 1].Name = "Referer";
f13cc9a
+            aMediaDescriptor[nLen - 1].Value <<= pMedium->GetName();
f13cc9a
         }
f13cc9a
 
f13cc9a
         uno::Reference < embed::XEmbeddedObject > xObj(
f13cc9a
-- 
f13cc9a
2.14.3
f13cc9a