summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-01 12:57:02 +0100
committerAndras Timar <andras.timar@collabora.com>2018-05-04 14:40:47 +0200
commit7a6b608591e21ef61dc05cff9fc58da531035755 (patch)
tree15e502533430804bb9d6a1a4438d5e8e8172d10f
parent685b3f8f607d37c2aa8e5d0268d8803ebd920b65 (diff)
set Referer on link mediadescriptordistro/collabora/cd-5.3-3.1
to allow determining if the source document is from a trusted/untrusted location Reviewed-on: https://gerrit.libreoffice.org/53693 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit cd25a97bbadc0a5c1fd6b0e8603c8b6ebd051926) Change-Id: I780568652d2ef0cc8543c27ba26289277b5d9d0c Reviewed-on: https://gerrit.libreoffice.org/53803 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 2d87c267267530077a94c894bc619831b01d1c04)
-rw-r--r--sw/source/filter/xml/xmltexti.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index 3cc7372f8986..a26e4f7640dc 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -575,17 +575,22 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink(
uno::Sequence< beans::PropertyValue > aMediaDescriptor( 1 );
aMediaDescriptor[0].Name = "URL";
- aMediaDescriptor[0].Value <<= OUString( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
- if ( pDoc->GetDocShell() && pDoc->GetDocShell()->GetMedium() )
+ aMediaDescriptor[0].Value <<= aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+
+ if (SfxMedium* pMedium = pDoc->GetDocShell() ? pDoc->GetDocShell()->GetMedium() : nullptr)
{
- uno::Reference< task::XInteractionHandler > xInteraction =
- pDoc->GetDocShell()->GetMedium()->GetInteractionHandler();
+ uno::Reference< task::XInteractionHandler > xInteraction = pMedium->GetInteractionHandler();
if ( xInteraction.is() )
{
aMediaDescriptor.realloc( 2 );
aMediaDescriptor[1].Name = "InteractionHandler";
aMediaDescriptor[1].Value <<= xInteraction;
}
+
+ const auto nLen = aMediaDescriptor.getLength() + 1;
+ aMediaDescriptor.realloc(nLen);
+ aMediaDescriptor[nLen - 1].Name = "Referer";
+ aMediaDescriptor[nLen - 1].Value <<= pMedium->GetName();
}
uno::Reference < embed::XEmbeddedObject > xObj(