Skip to content

Commit

Permalink
Merge pull request #28381 from yrodiere/config-editor-unquoting-error
Browse files Browse the repository at this point in the history
Fix ConfigDescriptionsManager misinterpreting a double-quote alone (`"`) as a quoted part
  • Loading branch information
gsmet authored Oct 4, 2022
2 parents 86b1e8f + a301634 commit b908974
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.quarkus.vertx.http.devconsole;

import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusDevModeTest;
import io.restassured.RestAssured;

/**
* Tests that a system property such as {@code %.intellij.command.histfile."}
* doesn't lead to an exception because {@code "} is incorrectly seen as a quoted property.
* <p>
* Originally the bug stemmed from an environment property {@code __INTELLIJ_COMMAND_HISTFILE__}
* which was (weirdly) interpreted as {@code %.intellij.command.histfile."},
* but it's much easier to test system properties (which are mutable)
* than environment properties.
*/
public class DevConsoleConfigMisinterpretedDoubleUnderscoreTest {

@RegisterExtension
static final QuarkusDevModeTest config = new QuarkusDevModeTest()
.setBuildSystemProperty("%.intellij.command.histfile.\"", "foo")
.withEmptyApplication();

@Test
public void testNoFailure() {
RestAssured.get("q/dev/io.quarkus.quarkus-vertx-http/config")
.then()
.statusCode(200).body(Matchers.containsString("Config Editor"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private String ensureQuoted(String part) {
}

private boolean isQuoted(String part) {
return part.charAt(0) == '\"' && part.charAt(part.length() - 1) == '\"';
return part.length() >= 2 && part.charAt(0) == '\"' && part.charAt(part.length() - 1) == '\"';
}

@Override
Expand Down

0 comments on commit b908974

Please sign in to comment.