From f5cf0c10eb7050feff19190b06b4597aab2d400a Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sat, 2 Dec 2023 16:57:30 +0900 Subject: tdf#123396 actually use the mimetype set in the from document MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the document we set the mime type for the images stored, but at import we never actually used the mime types. We always did mime type detection from the filename extension. The problem with this is that files stored as base64 streams don't have a filename so it is also not possible to determine the mime type from the file name. The consequence of this is that we can't know which image to take if we have multiple images (fallback images) so we always take the last one, which could be the wrong one. This happend in the test document. This changes the behavior so that we always first use the document set mime type as there is no reason to not trust that. Only if the mime type isn't provided by the document we use other mime type detection methods. Change-Id: I175c509ce5f11eab2c0454d4d9901ca1fe975272 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160237 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- xmloff/inc/xmlmultiimagehelper.hxx | 1 + 1 file changed, 1 insertion(+) (limited to 'xmloff/inc') diff --git a/xmloff/inc/xmlmultiimagehelper.hxx b/xmloff/inc/xmlmultiimagehelper.hxx index adfdce2e9285..b55e59324ed4 100644 --- a/xmloff/inc/xmlmultiimagehelper.hxx +++ b/xmloff/inc/xmlmultiimagehelper.hxx @@ -32,6 +32,7 @@ protected: /// helper to get the created xShape instance, override this virtual void removeGraphicFromImportContext(const SvXMLImportContext& rContext) = 0; virtual OUString getGraphicPackageURLFromImportContext(const SvXMLImportContext& rContext) const = 0; + virtual OUString getMimeTypeFromImportContext(const SvXMLImportContext& rContext) const = 0; virtual css::uno::Reference getGraphicFromImportContext(const SvXMLImportContext& rContext) const = 0; public: -- cgit