Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

659: Multi-line commands aren't filtered properly #1092

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -40,7 +40,7 @@
class ArchiveMessages {
private static final Pattern commentPattern = Pattern.compile("<!--.*?-->",
Pattern.DOTALL | Pattern.MULTILINE);
private static final Pattern commandPattern = Pattern.compile("^\\s*/([A-Za-z]+).*$", Pattern.MULTILINE);
private static final Pattern commandPattern = Pattern.compile("^\\s*/([A-Za-z]+).*$", Pattern.MULTILINE | Pattern.DOTALL);

private static String filterCommentsAndCommands(String body) {
var parsedBody = PullRequestBody.parse(body);
@@ -1494,6 +1494,7 @@ void filterComments(TestInfo testInfo) throws IOException {
pr.addComment("/integrate stuff");
pr.addComment("the command is /hello there");
pr.addComment("but this will be parsed\n/newline command");
pr.addComment("/multiline\nwill be dropped");
TestBotRunner.runPeriodicItems(mlBot);

// Run an archive pass
@@ -1514,6 +1515,8 @@ void filterComments(TestInfo testInfo) throws IOException {
assertTrue(archiveContains(archiveFolder.path(), "/hello there"));
assertTrue(archiveContains(archiveFolder.path(), "but this will be parsed"));
assertFalse(archiveContains(archiveFolder.path(), "/newline"));
assertFalse(archiveContains(archiveFolder.path(), "/multiline"));
assertFalse(archiveContains(archiveFolder.path(), "will be dropped"));
}
}