diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js index fa42b89b2f8e..c94b07ecce48 100644 --- a/filter/source/svg/presentation_engine.js +++ b/filter/source/svg/presentation_engine.js @@ -16217,7 +16217,17 @@ HyperlinkElement.prototype.handleClick = function( ) var aWindowObject = document.defaultView; if( aWindowObject ) { - aWindowObject.open( this.sURL, this.sId ); + var sProtocol = ''; + try + { + sProtocol = new URL( this.sURL, document.baseURI ).protocol; + } + catch( e ) + { + log( 'error: HyperlinkElement.handleClick: invalid url.' ); + } + if( sProtocol === 'http:' || sProtocol === 'https:' || sProtocol === 'mailto:' ) + aWindowObject.open( this.sURL, this.sId ); } else { diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 0c7a631127ad..9d9a6dccbd58 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -1309,7 +1310,15 @@ bool SVGTextWriter::nextTextPortion() #if OSL_DEBUG_LEVEL > 0 sInfo += "url: " + mrExport.GetRelativeReference( sURL ); #endif - msUrl = mrExport.GetRelativeReference( sURL ); + // A link to a place in the presentation starts with '#'. + INetURLObject aINetURLObject(sURL); + if (sURL.startsWith("#") + || (!aINetURLObject.HasError() + && !aINetURLObject.IsExoticProtocol() + && aINetURLObject.GetProtocol() != INetProtocol::Javascript)) + msUrl = mrExport.GetRelativeReference( sURL ); + else + msUrl.clear(); if( !msUrl.isEmpty() ) { implRegisterInterface( xPortionTextRange );