Fix - POST Bundle With ifNoneExist Clause Incorrectly Rejected With Invalid Match URL ERROR (#4588)
* Add a failing Unit Test and a changelog. * Fixed the regex to accept the dash character.
This commit is contained in:
parent
3554e9cf91
commit
b25f364369
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
type: fix
|
||||||
|
issue: 4580
|
||||||
|
title: "Fix the BaseTransactionProcessor.UNQUALIFIED_MATCH_URL_START REGEX so that it correctly matches patterns that contain dashes in them."
|
|
@ -27,6 +27,7 @@ import org.hl7.fhir.r4.model.IdType;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
public class BaseTransactionProcessorTest {
|
public class BaseTransactionProcessorTest {
|
||||||
|
|
||||||
|
@ -102,4 +103,11 @@ public class BaseTransactionProcessorTest {
|
||||||
assertEquals(input, outcome);
|
assertEquals(input, outcome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testUnqualifiedMatchUrlStart_RegexPatternMatches() {
|
||||||
|
String matchUrl = "patient-first-identifier=MRN%7C123456789";
|
||||||
|
boolean matchResult = BaseTransactionProcessor.UNQUALIFIED_MATCH_URL_START.matcher(matchUrl).find();
|
||||||
|
assertTrue(matchResult, "Failed to find a Regex match using Url '" + matchUrl + "'");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ public abstract class BaseTransactionProcessor {
|
||||||
|
|
||||||
public static final String URN_PREFIX = "urn:";
|
public static final String URN_PREFIX = "urn:";
|
||||||
public static final String URN_PREFIX_ESCAPED = UrlUtil.escapeUrlParam(URN_PREFIX);
|
public static final String URN_PREFIX_ESCAPED = UrlUtil.escapeUrlParam(URN_PREFIX);
|
||||||
public static final Pattern UNQUALIFIED_MATCH_URL_START = Pattern.compile("^[a-zA-Z0-9_]+=");
|
public static final Pattern UNQUALIFIED_MATCH_URL_START = Pattern.compile("^[a-zA-Z0-9_-]+=");
|
||||||
public static final Pattern INVALID_PLACEHOLDER_PATTERN = Pattern.compile("[a-zA-Z]+:.*");
|
public static final Pattern INVALID_PLACEHOLDER_PATTERN = Pattern.compile("[a-zA-Z]+:.*");
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(BaseTransactionProcessor.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(BaseTransactionProcessor.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
Loading…
Reference in New Issue