[Libreoffice-commits] core.git: svx/source sw/qa
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Tue May 22 04:56:39 UTC 2018
svx/source/xoutdev/_xoutbmp.cxx | 20 +-------------------
sw/qa/extras/htmlexport/htmlexport.cxx | 2 +-
2 files changed, 2 insertions(+), 20 deletions(-)
New commits:
commit 57cc8b2e4f93b3a93ce9ac46a2a98eb2a799faa3
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Fri May 18 16:26:37 2018 +0200
Fix svg to base64 conversion
This reverts part of ab14a9708d2937bc767c14542610ce91b56dda1e which had
a questionable fix by unconditionally removing the first 8 bytes of the svg
which led to svgs starting with
rsion="1.0" encoding="utf-8"?>
instead of
<?xml version="1.0" encoding="utf-8"?>
Change-Id: I8c4d78db1794473d20ddd77019ae81b88be0bb03
Reviewed-on: https://gerrit.libreoffice.org/54550
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 1e57b09bfe3c..3fc0110ed9e7 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -393,25 +393,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString)
css::uno::Sequence<sal_Int8> aOStmSeq( static_cast<sal_Int8 const *>(aOStm.GetData()),aOStm.Tell() );
OUStringBuffer aStrBuffer;
::comphelper::Base64::encode(aStrBuffer,aOStmSeq);
- OUString aEncodedBase64Image = aStrBuffer.makeStringAndClear();
- if( aLink.GetType() == GfxLinkType::NativeSvg )
- {
- sal_Int32 ite(8);
- sal_Int32 nBufferLength(aOStmSeq.getLength());
- const sal_Int8* pBuffer = aOStmSeq.getConstArray();
- css::uno::Sequence<sal_Int8> newTempSeq = aOStmSeq; // creates new Sequence to remove front 8 bits of garbage and encodes in base64
- sal_Int8 *pOutBuffer = newTempSeq.getArray();
- while(ite < nBufferLength)
- {
- *pOutBuffer++ = pBuffer[ite];
- ite++;
- }
- ::comphelper::Base64::encode(aStrBuffer, newTempSeq);
- aEncodedBase64Image = aStrBuffer.makeStringAndClear();
- sal_Int32 SVGFixLength = aEncodedBase64Image.getLength();
- aEncodedBase64Image = aEncodedBase64Image.replaceAt(SVGFixLength - 12, SVGFixLength, "") + "PC9zdmc+Cg=="; // removes rear 12 bits of garbage and adds svg closing tag in base64
- }
- rOUString = aMimeType + ";base64," + aEncodedBase64Image;
+ rOUString = aMimeType + ";base64," + aStrBuffer.makeStringAndClear();
return true;
}
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index f7aaec10a79b..4199ffeb4092 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -280,7 +280,7 @@ DECLARE_HTMLEXPORT_TEST(testExportImageBulletList, "tdf66822.odt")
// Encoded base64 SVG bullet should match and render on browser
assertXPath(pDoc, "/html/body/ul", 1);
- assertXPath(pDoc, "/html/body/ul", "style", "list-style-image: url(data:image/svg+xml;base64,cnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi04Ij8+DQo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTIuMC4xLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCA1MTQ0OCkgIC0tPg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIiBbDQoJPCFFTlRJVFkgbnNfc3ZnICJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQoJPCFFTlRJVFkgbnNfeGxpbmsgImh0dHA6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