diff options
author | Adityarup Laha <me@adityaruplaha.me> | 2022-03-13 01:19:34 +0530 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-03-13 10:15:04 +0100 |
commit | 69656132a00491b96da3a898c350f11e9619da64 (patch) | |
tree | 4d6bcef097cf6ccfeb4daff9663a44893b3330f5 /sfx2 | |
parent | 0fcb5d2fcb46214b3182f7837a99725f02b7bd61 (diff) |
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.kaganski@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
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 |