Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression on <?xml> header removal for SVG output #1747

Open
cristianofromagio opened this issue Apr 19, 2024 · 0 comments
Open

Regression on <?xml> header removal for SVG output #1747

cristianofromagio opened this issue Apr 19, 2024 · 0 comments
Labels

Comments

@cristianofromagio
Copy link

Describe the bug
This post on forum.plantuml.net says we remove the <?xml> header from the SVG output, but this feature is not actually the default behaviour for simple diagrams that output as SVG. For it to be removed, there needed to be (at least) an "image" embedded into the diagram. This would be reverted in a later commit, reverting the <?xml> header removal (in all SVG outputs). Later again, the removal was reverted because of a security patch was implemented and the default PLANTUML_SECURITY_PROFILE would prevent the image from being loaded (thus preventing the header from being removed), but the header removal was possible again using (at least) the PLANTUML_SECURITY_PROFILE=UNSECURE flag. More specific information below in the To reproduce section.

Proposed solution
Place removeXmlHeader() where it will be run independent if the diagram has embeded images or not.

  • Current:

    public void createXml(OutputStream os) throws TransformerException, IOException {
    if (images.size() == 0) {
    createXmlInternal(os);
    return;
    }
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    createXmlInternal(baos);
    String s = new String(baos.toByteArray());
    for (Map.Entry<String, String> ent : images.entrySet()) {
    final String k = "<" + ent.getKey() + "/>";
    s = s.replace(k, ent.getValue());
    }
    s = removeXmlHeader(s);
    os.write(s.getBytes());
    }

  • Proposed solution:

	public void createXml(OutputStream os) throws TransformerException, IOException {
		final ByteArrayOutputStream baos = new ByteArrayOutputStream();
		createXmlInternal(baos);
		String s = new String(baos.toByteArray());

		if (images.size() > 0) {
			for (Map.Entry<String, String> ent : images.entrySet()) {
				final String k = "<" + ent.getKey() + "/>";
				s = s.replace(k, ent.getValue());
			}
		}

		s = removeXmlHeader(s);
		os.write(s.getBytes());
	}

To Reproduce
I've created this repository for reproduction.

  • Since the forum post says the feature was implemented on version 1.2020.20beta14 I tried running tests on version 1.2020.21 (downloaded from sourceforge). This one is the important commit for this specific version for our issue. It is when the removeXmlHeader() was created on SvgGraphics.java.
  • The <?xml> header removal would later be disabled on this commit. It's also when apparently data:image/svg+xml;base64 image-embedding was introduced, with the SecurityProfile.UNSECURE and SecurityUtils.ALLOWLIST_LOCAL_PATHS appearing. Per GitHub releases page, this would impact versions 1.2022.5 and 1.2022.6.
  • For version 1.2022.7, this commit would revert back the <?xml> header removal but would also again restrict it to only when there was an image on the diagram but also only remove it if run with the PLANTUML_SECURITY_PROFILE=UNSECURE flag. This is still the current behaviour (tested with version 1.2024.4), the source file just moved from plantuml/src/net/sourceforge/plantuml/svg/SvgGraphics.java to plantuml/src/net/sourceforge/plantuml/klimt/drawing/svg/SvgGraphics.java.

transparent_squre.svg contents is <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="1" height="1"></svg>

PlantUML version Diagram input SVG output
1.2020.21 @startuml

a123 -> b123

@enduml
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="120px" preserveAspectRatio="none" style="width:125px;height:120px;" version="1.1" viewBox="0 0 125 120" width="125px" zoomAndPan="magnify"><defs><filter height="300%" id="f11ypd0vyem6wr" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:5.0,5.0;" x1="30" x2="30" y1="41.6094" y2="75.6094"/><line style="stroke:#A80036;stroke-width:1.0;stroke-dasharray:5.0,5.0;" x1="90" x2="90" y1="41.6094" y2="75.6094"/><rect fill="#FEFECE" filter="url(#f11ypd0vyem6wr)" height="31.6094" style="stroke:#A80036;stroke-width:1.5;" width="46" x="5" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="32" x="12" y="26.5332">a123</text><rect fill="#FEFECE" filter="url(#f11ypd0vyem6wr)" height="31.6094" style="stroke:#A80036;stroke-width:1.5;" width="46" x="5" y="74.6094"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="32" x="12" y="96.1426">a123</text><rect fill="#FEFECE" filter="url(#f11ypd0vyem6wr)" height="31.6094" style="stroke:#A80036;stroke-width:1.5;" width="46" x="65" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="32" x="72" y="26.5332">b123</text><rect fill="#FEFECE" filter="url(#f11ypd0vyem6wr)" height="31.6094" style="stroke:#A80036;stroke-width:1.5;" width="46" x="65" y="74.6094"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="32" x="72" y="96.1426">b123</text><polygon fill="#A80036" points="78,53.6094,88,57.6094,78,61.6094,82,57.6094" style="stroke:#A80036;stroke-width:1.0;"/><line style="stroke:#A80036;stroke-width:1.0;" x1="30" x2="84" y1="57.6094" y2="57.6094"/><!--MD5=[d2aae5215b397342709137d70dd82de3] @startuml a123 -> b123 @enduml PlantUML version 1.2020.21(Mon Nov 30 13:40:11 BRT 2020) (GPL source distribution) Java Runtime: Java(TM) SE Runtime Environment JVM: Java HotSpot(TM) 64-Bit Server VM Default Encoding: Cp1252 Language: pt Country: BR --></g></svg>
1.2020.21 @startuml

sprite $svgImg transparent_square.svg

rectangle "<$svgImg>"

a123 -> b123

@enduml
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="57px" preserveAspectRatio="none" style="width:152px;height:57px;" version="1.1" viewBox="0 0 152 57" width="152px" zoomAndPan="magnify"><defs><filter height="300%" id="f10o0t8uq914u9" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><!--MD5=[3dc6da71c8fb0d0c9787dc1d6a41055e] entity <$svgImg>--><rect fill="#FEFECE" filter="url(#f10o0t8uq914u9)" height="21" style="stroke:#000000;stroke-width:1.5;" width="21" x="119.5" y="7"/><svg x="129.5" y="17"></svg><!--MD5=[a18a8af657cdaaee07753645a9553d1f] entity a123--><ellipse cx="22" cy="17.5" fill="#FEFECE" filter="url(#f10o0t8uq914u9)" rx="8" ry="8" style="stroke:#A80036;stroke-width:1.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="32" x="6" y="49.0332">a123</text><!--MD5=[35243d594c152e381415c069eedc0eea] entity b123--><ellipse cx="75" cy="17.5" fill="#FEFECE" filter="url(#f10o0t8uq914u9)" rx="8" ry="8" style="stroke:#A80036;stroke-width:1.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="32" x="59" y="49.0332">b123</text><!--MD5=[84b0b4814b8331ffdaba207bee986135] link a123 to b123--><path d="M31.11,17.5 C40.94,17.5 50.77,17.5 60.6,17.5 " fill="none" id="a123-to-b123" style="stroke:#A80036;stroke-width:1.0;"/><polygon fill="#A80036" points="65.74,17.5,56.74,13.5,60.74,17.5,56.74,21.5,65.74,17.5" style="stroke:#A80036;stroke-width:1.0;"/><!--MD5=[54bea71e48bfa6f6f331b0c181c4247a] @startuml sprite $svgImg transparent_square.svg rectangle "<$svgImg>" a123 -> b123 @enduml PlantUML version 1.2020.21(Mon Nov 30 13:40:11 BRT 2020) (GPL source distribution) Java Runtime: Java(TM) SE Runtime Environment JVM: Java HotSpot(TM) 64-Bit Server VM Default Encoding: Cp1252 Language: pt Country: BR --></g></svg>
1.2022.6 @startuml

a123 -> b123

@enduml
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="108px" preserveAspectRatio="none" style="width:113px;height:108px;background:#FFFFFF;" version="1.1" viewBox="0 0 113 108" width="113px" zoomAndPan="magnify"><defs/><g><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="28" x2="28" y1="37.6094" y2="71.6094"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="84" x2="84" y1="37.6094" y2="71.6094"/><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="5" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="12" y="26.5332">a123</text><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="5" y="70.6094"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="12" y="92.1426">a123</text><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="61" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="68" y="26.5332">b123</text><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="61" y="70.6094"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="68" y="92.1426">b123</text><polygon fill="#181818" points="72,49.6094,82,53.6094,72,57.6094,76,53.6094" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="28" x2="78" y1="53.6094" y2="53.6094"/><!--MD5=[8b1ee5e63c1ca3978ea932ec6f3f5fa0] @startuml a123 -> b123 @enduml PlantUML version 1.2022.6(Tue Jun 21 14:34:49 BRT 2022) (GPL source distribution) Java Runtime: Java(TM) SE Runtime Environment JVM: Java HotSpot(TM) 64-Bit Server VM Default Encoding: Cp1252 Language: pt Country: BR --></g></svg>
1.2022.6 @startuml

sprite $svgImg transparent_square.svg

rectangle "<$svgImg>"

a123 -> b123

@enduml
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="57px" preserveAspectRatio="none" style="width:146px;height:57px;background:#FFFFFF;" version="1.1" viewBox="0 0 146 57" width="146px" zoomAndPan="magnify"><defs/><g><!--MD5=[3dc6da71c8fb0d0c9787dc1d6a41055e] entity <$svgImg>--><g id="elem_&lt;$svgImg&gt;"><rect fill="#F1F1F1" height="21" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="21" x="119.5" y="7"/><image height="1" width="1" x="129.5" xlink:href="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEiIHdpZHRoPSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciID48L3N2Zz4=" y="17"/></g><!--MD5=[a18a8af657cdaaee07753645a9553d1f] entity a123--><g id="elem_a123"><ellipse cx="22" cy="17.5" fill="#F1F1F1" rx="8" ry="8" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="6" y="49.0332">a123</text></g><!--MD5=[35243d594c152e381415c069eedc0eea] entity b123--><g id="elem_b123"><ellipse cx="75" cy="17.5" fill="#F1F1F1" rx="8" ry="8" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="59" y="49.0332">b123</text></g><!--MD5=[84b0b4814b8331ffdaba207bee986135] link a123 to b123--><g id="link_a123_b123"><path d="M31.11,17.5 C40.94,17.5 50.77,17.5 60.6,17.5 " fill="none" id="a123-to-b123" style="stroke:#181818;stroke-width:1.0;"/><polygon fill="#181818" points="65.74,17.5,56.74,13.5,60.74,17.5,56.74,21.5,65.74,17.5" style="stroke:#181818;stroke-width:1.0;"/></g><!--MD5=[ea32b0b84923114f0347f3f1073326ce] @startuml sprite $svgImg transparent_square.svg rectangle "<$svgImg>" a123 -> b123 @enduml PlantUML version 1.2022.6(Tue Jun 21 14:34:49 BRT 2022) (GPL source distribution) Java Runtime: Java(TM) SE Runtime Environment JVM: Java HotSpot(TM) 64-Bit Server VM Default Encoding: Cp1252 Language: pt Country: BR --></g></svg>
1.2022.6 (PLANTUML_SECURITY_PROFILE=UNSECURE) @startuml

sprite $svgImg transparent_square.svg

rectangle "<$svgImg>"

a123 -> b123

@enduml
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="57px" preserveAspectRatio="none" style="width:146px;height:57px;background:#FFFFFF;" version="1.1" viewBox="0 0 146 57" width="146px" zoomAndPan="magnify"><defs/><g><!--MD5=[3dc6da71c8fb0d0c9787dc1d6a41055e] entity <$svgImg>--><g id="elem_&lt;$svgImg&gt;"><rect fill="#F1F1F1" height="21" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="21" x="119.5" y="7"/><image height="1" width="1" x="129.5" xlink:href="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEiIHdpZHRoPSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciID48L3N2Zz4=" y="17"/></g><!--MD5=[a18a8af657cdaaee07753645a9553d1f] entity a123--><g id="elem_a123"><ellipse cx="22" cy="17.5" fill="#F1F1F1" rx="8" ry="8" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="6" y="49.0332">a123</text></g><!--MD5=[35243d594c152e381415c069eedc0eea] entity b123--><g id="elem_b123"><ellipse cx="75" cy="17.5" fill="#F1F1F1" rx="8" ry="8" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="59" y="49.0332">b123</text></g><!--MD5=[84b0b4814b8331ffdaba207bee986135] link a123 to b123--><g id="link_a123_b123"><path d="M31.11,17.5 C40.94,17.5 50.77,17.5 60.6,17.5 " fill="none" id="a123-to-b123" style="stroke:#181818;stroke-width:1.0;"/><polygon fill="#181818" points="65.74,17.5,56.74,13.5,60.74,17.5,56.74,21.5,65.74,17.5" style="stroke:#181818;stroke-width:1.0;"/></g><!--MD5=[dffc1b56954d0c85a5ed8c739558eb4f] @startuml sprite $svgImg transparent_square.svg rectangle "<$svgImg>" a123 -> b123 @enduml PlantUML version 1.2022.6(Tue Jun 21 14:34:49 BRT 2022) (GPL source distribution) Java Runtime: Java(TM) SE Runtime Environment JVM: Java HotSpot(TM) 64-Bit Server VM Java Version: 1.8.0_401-b10 Operating System: Windows 10 OS Version: 10.0 Default Encoding: Cp1252 Language: pt Country: BR --></g></svg>
1.2024.4 @startuml

a123 -> b123

@enduml
<?xml version="1.0" encoding="us-ascii" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="108px" preserveAspectRatio="none" style="width:113px;height:108px;background:#FFFFFF;" version="1.1" viewBox="0 0 113 108" width="113px" zoomAndPan="magnify"><defs/><g><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="28" x2="28" y1="37.6094" y2="71.6094"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="84" x2="84" y1="37.6094" y2="71.6094"/><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="5" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="12" y="26.5332">a123</text><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="5" y="70.6094"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="12" y="92.1426">a123</text><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="61" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="68" y="26.5332">b123</text><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="61" y="70.6094"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="68" y="92.1426">b123</text><polygon fill="#181818" points="72,49.6094,82,53.6094,72,57.6094,76,53.6094" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="28" x2="78" y1="53.6094" y2="53.6094"/><!--SRC=[IpGqCbRGjLD80j9S0000]--></g></svg>
1.2024.4 @startuml

sprite $svgImg transparent_square.svg

rectangle "<$svgImg>"

a123 -> b123

@enduml
<?xml version="1.0" encoding="us-ascii" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="57px" preserveAspectRatio="none" style="width:146px;height:57px;background:#FFFFFF;" version="1.1" viewBox="0 0 146 57" width="146px" zoomAndPan="magnify"><defs/><g><!--entity <$svgImg>--><g id="elem_&lt;$svgImg&gt;"><rect fill="#F1F1F1" height="21" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="21" x="119.5" y="7"/><image height="1" width="1" x="129.5" xlink:href="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEiIHdpZHRoPSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciID48L3N2Zz4=" y="17"/></g><!--entity a123--><g id="elem_a123"><ellipse cx="22" cy="17.5" fill="#F1F1F1" rx="8" ry="8" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="6" y="49.0332">a123</text></g><!--entity b123--><g id="elem_b123"><ellipse cx="75" cy="17.5" fill="#F1F1F1" rx="8" ry="8" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="59" y="49.0332">b123</text></g><!--link a123 to b123--><g id="link_a123_b123"><path d="M31.11,17.5 C42.65,17.5 48.2,17.5 59.74,17.5 " fill="none" id="a123-to-b123" style="stroke:#181818;stroke-width:1.0;"/><polygon fill="#181818" points="65.74,17.5,56.74,13.5,60.74,17.5,56.74,21.5,65.74,17.5" style="stroke:#181818;stroke-width:1.0;"/></g><!--SRC=[AoueoYn9LL0fBaltp4rNA2bAp2ikI2nApIk9Boui1JBqW39SN4MfoIM9UUavgGfADb2rTafSN8c6HiOAkdOAIK2Q2m00]--></g></svg>
1.2024.4 (PLANTUML_SECURITY_PROFILE=UNSECURE) @startuml

a123 -> b123

@enduml
<?xml version="1.0" encoding="us-ascii" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="108px" preserveAspectRatio="none" style="width:113px;height:108px;background:#FFFFFF;" version="1.1" viewBox="0 0 113 108" width="113px" zoomAndPan="magnify"><defs/><g><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="28" x2="28" y1="37.6094" y2="71.6094"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="84" x2="84" y1="37.6094" y2="71.6094"/><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="5" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="12" y="26.5332">a123</text><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="5" y="70.6094"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="12" y="92.1426">a123</text><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="61" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="68" y="26.5332">b123</text><rect fill="#E2E2F0" height="31.6094" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="46" x="61" y="70.6094"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="68" y="92.1426">b123</text><polygon fill="#181818" points="72,49.6094,82,53.6094,72,57.6094,76,53.6094" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="28" x2="78" y1="53.6094" y2="53.6094"/><!--SRC=[IpGqCbRGjLD80j9S0000]--></g></svg>
1.2024.4 (PLANTUML_SECURITY_PROFILE=UNSECURE) @startuml

sprite $svgImg transparent_square.svg

rectangle "<$svgImg>"

a123 -> b123

@enduml
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="57px" preserveAspectRatio="none" style="width:146px;height:57px;background:#FFFFFF;" version="1.1" viewBox="0 0 146 57" width="146px" zoomAndPan="magnify"><defs/><g><!--entity <$svgImg>--><g id="elem_&lt;$svgImg&gt;"><rect fill="#F1F1F1" height="21" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="21" x="119.5" y="7"/><svg x="129.5" y="17"></svg></g><!--entity a123--><g id="elem_a123"><ellipse cx="22" cy="17.5" fill="#F1F1F1" rx="8" ry="8" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="6" y="49.0332">a123</text></g><!--entity b123--><g id="elem_b123"><ellipse cx="75" cy="17.5" fill="#F1F1F1" rx="8" ry="8" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="32" x="59" y="49.0332">b123</text></g><!--link a123 to b123--><g id="link_a123_b123"><path d="M31.11,17.5 C42.65,17.5 48.2,17.5 59.74,17.5 " fill="none" id="a123-to-b123" style="stroke:#181818;stroke-width:1.0;"/><polygon fill="#181818" points="65.74,17.5,56.74,13.5,60.74,17.5,56.74,21.5,65.74,17.5" style="stroke:#181818;stroke-width:1.0;"/></g><!--SRC=[AoueoYn9LL0fBaltp4rNA2bAp2ikI2nApIk9Boui1JBqW39SN4MfoIM9UUavgGfADb2rTafSN8c6HiOAkdOAIK2Q2m00]--></g></svg>

Expected behavior
To remove <?xml> header declaration on all SVG output.

Desktop (please complete the following information):

  • OS: Windows 10 (10.0.19045)
  • Versions (PlantUML?):
    • 1.2020.21 (removes header, if has image)
    • 1.2022.6 (does not remove, ever)
    • 1.2024.4 (removes header, if has image and flag)

Additional context
I landed on this bug because SVG output images from PlantUML would not display in QOwnNotes on Windows. I managed to narrow it down to the encoding (PlantUML now uses us-ascii instead of UTF-8 since version 1.2023.2 based on this forum post and the specific commit). I suspect it is an encoding conflict between the embedded SVG content and the (Qt) browser engine used by QOwnNotes. Since this issue report is to remove the <?xml> header declaration, this would solve that issue too (and probably others that embed the SVG output into documents).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant