Skip to content

Commit 1ee4151

Browse files
authored
fix(svgbob): remove quote around value (#2013)
1 parent cc0dedb commit 1ee4151

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ci/tests/smoke.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const tests = [
2424
{ engine: 'plantuml', file: 'architecture.puml', options: {}, outputFormat: ['svg', 'pdf', 'png', 'txt'] },
2525
{ engine: 'plantuml', file: 'architecture.puml', options: { 'no-metadata': 'true' }, outputFormat: ['svg', 'png'] },
2626
{ engine: 'svgbob', file: 'cloud.bob', options: {}, outputFormat: ['svg'] },
27+
{ engine: 'svgbob', file: 'cloud.bob', options: {'font-size': '14'}, outputFormat: ['svg'] },
2728
{ engine: 'nomnoml', file: 'pirate.nomnoml', options: {}, outputFormat: ['svg'] },
2829
{ engine: 'packetdiag', file: 'packet.diag', options: {}, outputFormat: ['svg', 'png'] },
2930
{ engine: 'rackdiag', file: 'rack.diag', options: {}, outputFormat: ['svg', 'png'] },

server/src/main/java/io/kroki/server/service/Svgbob.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,16 @@ private byte[] svgbob(byte[] source, JsonObject options) throws IOException, Int
6868
addOption("font-size", options, commands);
6969
addOption("scale", options, commands);
7070
addOption("stroke-width", options, commands);
71-
return commander.execute(source, commands.toArray(new String[0]));
71+
String[] args = commands.toArray(new String[0]);
72+
return commander.execute(source, args);
7273
}
7374

7475
private void addOption(String optionKey, JsonObject options, List<String> commands) {
7576
String value = options.getString(optionKey);
7677
if (value != null) {
7778
String safeValue = value.replaceAll("[-\"$/@*&=;:!\\\\]", "");
78-
commands.add("--" + optionKey + "=\"" + safeValue + "\"");
79+
// No need to quote safeValue: ProcessBuilder passes arguments directly to the OS without shell interpretation.
80+
commands.add("--" + optionKey + "=" + safeValue);
7981
}
8082
}
8183
}

0 commit comments

Comments
 (0)