Missing fix from #3197
This commit is contained in:
parent
0099749a27
commit
1a1243db34
|
@ -1826,8 +1826,14 @@ public abstract class BaseTransactionProcessor {
|
||||||
}
|
}
|
||||||
IIdType replacement = theIdSubstitutions.getForSource(paramValue);
|
IIdType replacement = theIdSubstitutions.getForSource(paramValue);
|
||||||
if (replacement != null) {
|
if (replacement != null) {
|
||||||
matchUrl = matchUrl.substring(0, equalsIdx + 1) + replacement.getValue() + matchUrl.substring(endIdx);
|
String replacementValue;
|
||||||
searchFrom = equalsIdx + 1 + replacement.getValue().length();
|
if (replacement.hasVersionIdPart()) {
|
||||||
|
replacementValue = replacement.toVersionless().getValue();
|
||||||
|
} else {
|
||||||
|
replacementValue = replacement.getValue();
|
||||||
|
}
|
||||||
|
matchUrl = matchUrl.substring(0, equalsIdx + 1) + replacementValue + matchUrl.substring(endIdx);
|
||||||
|
searchFrom = equalsIdx + 1 + replacementValue.length();
|
||||||
} else {
|
} else {
|
||||||
searchFrom = endIdx;
|
searchFrom = endIdx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,13 @@ public class BaseTransactionProcessorTest {
|
||||||
assertEquals("Patient?foo=Patient/123&bar=baz", outcome);
|
assertEquals("Patient?foo=Patient/123&bar=baz", outcome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure versioned targets get the version stripped
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testPerformIdSubstitutionsInMatchUrl_MatchAtEnd() {
|
void testPerformIdSubstitutionsInMatchUrl_MatchAtEnd() {
|
||||||
IdSubstitutionMap idSubstitutions = new IdSubstitutionMap();
|
IdSubstitutionMap idSubstitutions = new IdSubstitutionMap();
|
||||||
idSubstitutions.put(new IdType("urn:uuid:7ea4f3a6-d2a3-4105-9f31-374d525085d4"), new IdType("Patient/123"));
|
idSubstitutions.put(new IdType("urn:uuid:7ea4f3a6-d2a3-4105-9f31-374d525085d4"), new IdType("Patient/123/_history/1"));
|
||||||
String outcome = BaseTransactionProcessor.performIdSubstitutionsInMatchUrl(idSubstitutions, "Patient?name=FAMILY1&organization=urn%3Auuid%3A7ea4f3a6-d2a3-4105-9f31-374d525085d4");
|
String outcome = BaseTransactionProcessor.performIdSubstitutionsInMatchUrl(idSubstitutions, "Patient?name=FAMILY1&organization=urn%3Auuid%3A7ea4f3a6-d2a3-4105-9f31-374d525085d4");
|
||||||
assertEquals("Patient?name=FAMILY1&organization=Patient/123", outcome);
|
assertEquals("Patient?name=FAMILY1&organization=Patient/123", outcome);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue