From 348d21f4fa22f52741b7924c0cca20f98f196d41 Mon Sep 17 00:00:00 2001 From: Jason Dahlke Date: Fri, 26 Apr 2024 13:27:22 +0000 Subject: [PATCH] update trailing character cleanup regex in FlexibleDateTimeParser --- src/main/java/emissary/util/FlexibleDateTimeParser.java | 2 +- src/test/java/emissary/util/FlexibleDateTimeParserTest.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/emissary/util/FlexibleDateTimeParser.java b/src/main/java/emissary/util/FlexibleDateTimeParser.java index 1dc65a0181..c098efc56f 100644 --- a/src/main/java/emissary/util/FlexibleDateTimeParser.java +++ b/src/main/java/emissary/util/FlexibleDateTimeParser.java @@ -51,7 +51,7 @@ public class FlexibleDateTimeParser { private static final Pattern REPLACE = Pattern.compile("\t+|[ ]+", Pattern.DOTALL); /* Remove other junk */ - private static final Pattern REMOVE = Pattern.compile("<.+?>|=0D$", Pattern.DOTALL); + private static final Pattern REMOVE = Pattern.compile("<.+?>$|=0D$", Pattern.DOTALL); /* timezone - config var: TIMEZONE */ private static ZoneId timezone = ZoneId.of(DEFAULT_TIMEZONE); diff --git a/src/test/java/emissary/util/FlexibleDateTimeParserTest.java b/src/test/java/emissary/util/FlexibleDateTimeParserTest.java index bd6c87203f..d7911aacde 100644 --- a/src/test/java/emissary/util/FlexibleDateTimeParserTest.java +++ b/src/test/java/emissary/util/FlexibleDateTimeParserTest.java @@ -420,6 +420,7 @@ void parse_yyyy_DDD() { @Test void testCleanDateString() { test("2016-01-04 18:20
", EXPECTED_NO_SECS, "HTML"); + test("2016-01-04 18:20
br>", EXPECTED_NO_SECS, "HTML"); test("2016-01-04\t\t18:20", EXPECTED_NO_SECS, "TABS"); test("2016-01-04 18:20", EXPECTED_NO_SECS, "SPACES"); test("2016-01-04 18:20=0D", EXPECTED_NO_SECS, "qp'ified ending");