diff --git a/core/src/main/java/org/jenkins/ui/symbol/Symbol.java b/core/src/main/java/org/jenkins/ui/symbol/Symbol.java index 9973acc18da5e..961e7e524c310 100644 --- a/core/src/main/java/org/jenkins/ui/symbol/Symbol.java +++ b/core/src/main/java/org/jenkins/ui/symbol/Symbol.java @@ -8,6 +8,7 @@ import hudson.Util; import java.io.IOException; import java.io.InputStream; +import java.io.StringWriter; import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -15,6 +16,23 @@ import java.util.logging.Logger; import jenkins.model.Jenkins; import org.apache.commons.io.IOUtils; +import org.apache.tools.ant.filters.StringInputStream; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; /** * Helper class to load symbols from Jenkins core or plugins. @@ -88,12 +106,37 @@ private static String loadSymbol(String namespace, String name) { LOGGER.log(Level.FINE, "Failed to load symbol " + name, e); } } - return markup.replaceAll("().*?()", "$1$2") - .replaceAll(" "The given src for the svg is not a valid xml document"); + return PLACEHOLDER_SVG; + } + + return markup; } @CheckForNull diff --git a/war/src/main/resources/images/symbols/journal.svg b/war/src/main/resources/images/symbols/journal.svg index 7bd396468079b..26170aed452d9 100644 --- a/war/src/main/resources/images/symbols/journal.svg +++ b/war/src/main/resources/images/symbols/journal.svg @@ -1 +1 @@ -ionicons-v5-o \ No newline at end of file +ionicons-v5-o \ No newline at end of file diff --git a/war/src/main/resources/images/symbols/lock-closed.svg b/war/src/main/resources/images/symbols/lock-closed.svg index 96a5e417f4ae2..2e0cdde7c7c00 100644 --- a/war/src/main/resources/images/symbols/lock-closed.svg +++ b/war/src/main/resources/images/symbols/lock-closed.svg @@ -1 +1 @@ -ionicons-v5-g \ No newline at end of file +ionicons-v5-g \ No newline at end of file diff --git a/war/src/main/resources/images/symbols/play.svg b/war/src/main/resources/images/symbols/play.svg index a9bb95b897a9c..ffc227bf89e2b 100644 --- a/war/src/main/resources/images/symbols/play.svg +++ b/war/src/main/resources/images/symbols/play.svg @@ -1 +1 @@ -ionicons-v5-c \ No newline at end of file +ionicons-v5-c \ No newline at end of file diff --git a/war/src/main/resources/images/symbols/power.svg b/war/src/main/resources/images/symbols/power.svg index cc2d4d57b63c8..92886b46a09ae 100644 --- a/war/src/main/resources/images/symbols/power.svg +++ b/war/src/main/resources/images/symbols/power.svg @@ -1 +1 @@ -ionicons-v5-p \ No newline at end of file +ionicons-v5-p \ No newline at end of file diff --git a/war/src/main/resources/images/symbols/trash-bin.svg b/war/src/main/resources/images/symbols/trash-bin.svg index d8449544a7a85..572cb143609f8 100644 --- a/war/src/main/resources/images/symbols/trash-bin.svg +++ b/war/src/main/resources/images/symbols/trash-bin.svg @@ -1 +1 @@ -ionicons-v5-k \ No newline at end of file +ionicons-v5-k \ No newline at end of file