mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 12:02:20 +00:00
[JENKINS-73243] quote replacement string in symbol tooltips (#9347)
This commit is contained in:
1 parent
8088382929
commit
5978ebe594
2 files changed
+21
-3
No files matched your search
@@ -14,6 +14,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
@@ -72,13 +73,13 @@ public final class Symbol {
|
||||
.computeIfAbsent(identifier, key -> new ConcurrentHashMap<>())
|
||||
.computeIfAbsent(name, key -> loadSymbol(identifier, key));
|
||||
if ((tooltip != null && !tooltip.isBlank()) && (htmlTooltip == null || htmlTooltip.isBlank())) {
|
||||
symbol = symbol.replaceAll("<svg", "<svg tooltip=\"" + Functions.htmlAttributeEscape(tooltip) + "\"");
|
||||
symbol = symbol.replaceAll("<svg", Matcher.quoteReplacement("<svg tooltip=\"" + Functions.htmlAttributeEscape(tooltip) + "\""));
|
||||
}
|
||||
if (htmlTooltip != null && !htmlTooltip.isBlank()) {
|
||||
symbol = symbol.replaceAll("<svg", "<svg data-html-tooltip=\"" + Functions.htmlAttributeEscape(htmlTooltip) + "\"");
|
||||
symbol = symbol.replaceAll("<svg", Matcher.quoteReplacement("<svg data-html-tooltip=\"" + Functions.htmlAttributeEscape(htmlTooltip) + "\""));
|
||||
}
|
||||
if (id != null && !id.isBlank()) {
|
||||
symbol = symbol.replaceAll("<svg", "<svg id=\"" + Functions.htmlAttributeEscape(id) + "\"");
|
||||
symbol = symbol.replaceAll("<svg", Matcher.quoteReplacement("<svg id=\"" + Functions.htmlAttributeEscape(id) + "\""));
|
||||
}
|
||||
if (classes != null && !classes.isBlank()) {
|
||||
symbol = symbol.replaceAll("<svg", "<svg class=\"" + Functions.htmlAttributeEscape(classes) + "\"");
|
||||
|
||||
Reference in new issue
Block a user