sfx2/source/appl/appopen.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
New commits: commit 69656132a00491b96da3a898c350f11e9619da64 Author: Adityarup Laha <m...@adityaruplaha.me> AuthorDate: Sun Mar 13 01:19:34 2022 +0530 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Mar 13 10:15:04 2022 +0100 tdf#136427: Attempt opening native documents for known protocols only. Only try to open native documents (ODT, ODS, etc.) in frame for known protocols. This is to prevent LO from trying to handle internal protocol links when the file has a native extension. Change-Id: I908783b0d24330ec44caa9ddeca2511426001cf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131449 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index a2e3fc5e3f10..89d8266aa9bd 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -843,9 +843,18 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) return; } - const OUString aTypeName { xTypeDetection->queryTypeByURL( aURL.Main ) }; - SfxFilterMatcher& rMatcher = SfxGetpApp()->GetFilterMatcher(); - std::shared_ptr<const SfxFilter> pFilter = rMatcher.GetFilter4EA( aTypeName ); + std::shared_ptr<const SfxFilter> pFilter{}; + + // attempt loading native documents only if they are from a known protocol + // it might be sensible to limit the set of protocols even further, but that + // may cause regressions, needs further testing + // see tdf#136427 for details + if (aINetProtocol != INetProtocol::NotValid) { + const OUString aTypeName { xTypeDetection->queryTypeByURL( aURL.Main ) }; + SfxFilterMatcher& rMatcher = SfxGetpApp()->GetFilterMatcher(); + pFilter = rMatcher.GetFilter4EA( aTypeName ); + } + if (!pFilter || !lcl_isFilterNativelySupported(*pFilter)) { // hyperlink does not link to own type => special handling (http, ftp) browser and (other external protocols) OS