mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-24 13:57:33 +00:00
Version 1.2022.14
This commit is contained in:
parent
3cf5e15bb4
commit
117102bb65
@ -293,11 +293,11 @@ public enum FileFormat {
|
||||
if (svg == null)
|
||||
return false;
|
||||
|
||||
final String currentSignature = SvgGraphics.getMD5Hex(currentMetadata);
|
||||
final int idx = svg.lastIndexOf(SvgGraphics.MD5_HEADER);
|
||||
final String currentSignature = SvgGraphics.getMetadataHex(currentMetadata);
|
||||
final int idx = svg.lastIndexOf(SvgGraphics.META_HEADER);
|
||||
if (idx != -1) {
|
||||
final String part = svg.substring(idx + SvgGraphics.MD5_HEADER.length());
|
||||
return part.startsWith(currentSignature);
|
||||
final String part = svg.substring(idx + SvgGraphics.META_HEADER.length());
|
||||
return part.startsWith(currentSignature + "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -245,10 +245,14 @@ public class SURL {
|
||||
}
|
||||
|
||||
private boolean forbiddenURL(String full) {
|
||||
if (full.startsWith("https://") == false && full.startsWith("http://") == false)
|
||||
return true;
|
||||
if (full.matches("^https?://[-#.0-9:\\[\\]+]+/.*"))
|
||||
return true;
|
||||
if (full.matches("^https?://[^.]+/.*"))
|
||||
return true;
|
||||
if (full.matches("^https?://[^.]+$"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,9 @@ public class Style {
|
||||
public UFont getUFont() {
|
||||
final String family = value(PName.FontName).asString();
|
||||
final int fontStyle = value(PName.FontStyle).asFontStyle();
|
||||
final int size = value(PName.FontSize).asInt();
|
||||
int size = value(PName.FontSize).asInt();
|
||||
if (size == 0)
|
||||
size = 14;
|
||||
return new UFont(family, fontStyle, size);
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,8 @@ public class ValueImpl implements Value {
|
||||
public int asInt() {
|
||||
String s = value.getValue1();
|
||||
s = s.replaceAll("[^0-9]", "");
|
||||
if (s.length() == 0)
|
||||
return 0;
|
||||
return Integer.parseInt(s);
|
||||
}
|
||||
|
||||
|
@ -67,9 +67,9 @@ import org.w3c.dom.Element;
|
||||
|
||||
import net.sourceforge.plantuml.FileUtils;
|
||||
import net.sourceforge.plantuml.Log;
|
||||
import net.sourceforge.plantuml.SignatureUtils;
|
||||
import net.sourceforge.plantuml.awt.geom.XDimension2D;
|
||||
import net.sourceforge.plantuml.code.Base64Coder;
|
||||
import net.sourceforge.plantuml.code.TranscoderUtil;
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.security.SImageIO;
|
||||
import net.sourceforge.plantuml.security.SecurityProfile;
|
||||
@ -985,15 +985,25 @@ public class SvgGraphics {
|
||||
this.hidden = hidden;
|
||||
}
|
||||
|
||||
public static final String MD5_HEADER = "<!--MD5=[";
|
||||
public static final String META_HEADER = "<!--SRC=[";
|
||||
|
||||
public static String getMD5Hex(String comment) {
|
||||
return SignatureUtils.getMD5Hex(comment);
|
||||
public static String getMetadataHex(String comment) {
|
||||
try {
|
||||
final String encoded = TranscoderUtil.getDefaultTranscoderProtected().encode(comment);
|
||||
return encoded;
|
||||
} catch (IOException e) {
|
||||
return "ERROR42";
|
||||
}
|
||||
}
|
||||
|
||||
public void addCommentMetadata(String metadata) {
|
||||
final String signature = getMetadataHex(metadata);
|
||||
final String comment = "SRC=[" + signature + "]";
|
||||
final Comment commentElement = document.createComment(comment);
|
||||
getG().appendChild(commentElement);
|
||||
}
|
||||
|
||||
public void addComment(String comment) {
|
||||
final String signature = getMD5Hex(comment);
|
||||
comment = "MD5=[" + signature + "]\n" + comment;
|
||||
final Comment commentElement = document.createComment(comment);
|
||||
getG().appendChild(commentElement);
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
|
||||
public void writeToStream(OutputStream os, String metadata, int dpi) throws IOException {
|
||||
try {
|
||||
if (metadata != null)
|
||||
getGraphicObject().addComment(metadata);
|
||||
getGraphicObject().addCommentMetadata(metadata);
|
||||
|
||||
if (interactive) {
|
||||
// For performance reasons and also because we want the entire graph DOM to be
|
||||
|
@ -45,7 +45,7 @@ public class Version {
|
||||
private static final int MAJOR_SEPARATOR = 1000000;
|
||||
|
||||
public static int version() {
|
||||
return 1202213;
|
||||
return 1202214;
|
||||
}
|
||||
|
||||
public static int versionPatched() {
|
||||
@ -81,7 +81,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 7;
|
||||
final int beta = 0;
|
||||
return beta;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static long compileTime() {
|
||||
return 1668864137549L;
|
||||
return 1670351053526L;
|
||||
}
|
||||
|
||||
public static String compileTimeString() {
|
||||
|
Loading…
Reference in New Issue
Block a user