From 579c2de3a88483eff0664d3a303b19cbd386db47 Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Wed, 27 Apr 2016 16:19:13 +0300 Subject: tdf#80999 Canceling password prompt should abort detection ... instead of continuing the detection loop and being "detected" as plain text. The detection API will from now return a type based on the file extension only, which is far more useful than "plain text" anyway. Plus the media descriptor has a flag to indicate that the detection wasn't completed, which can be also used by the loading code to abort the loading process. Change-Id: Ida37e2687bd5cd86b5780620724e9bce82e11946 Reviewed-on: https://gerrit.libreoffice.org/24428 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky --- framework/source/loadenv/loadenv.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'framework/source') diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 4c3c8b1d8646..64c0a8ffff69 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -791,6 +791,11 @@ void LoadEnv::impl_detectTypeAndFilter() aWriteLock.clear(); // <- SAFE + // We do have potentially correct type, but the detection process was aborted. + if (m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_ABORTED(), false)) + throw LoadEnvException( + LoadEnvException::ID_UNSUPPORTED_CONTENT, "type detection aborted"); + // But the type isn't enough. For loading sometimes we need more information. // E.g. for our "_default" feature, where we recycle any frame which contains // and "Untitled" document, we must know if the new document is based on a template! -- cgit