diff --git a/NEWS.md b/NEWS.md index 40f0bf0..7136688 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +## 1.13.1 2023-04-05 +* [MODNCIP-55](https://issues.folio.org/browse/MODNCIP-55)- alternate user lookup service fix ## 1.13.0 2023-02-23 * [MODNCIP-49](https://issues.folio.org/browse/MODNCIP-49) -CQL and URL injection * Updated logging - common logging diff --git a/pom.xml b/pom.xml index b266f5f..07884c4 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.folio mod-ncip - 1.13.1-SNAPSHOT + 1.13.2-SNAPSHOT NCIP NCIP responder for FOLIO (internal module) diff --git a/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java b/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java index d7da816..5c49186 100644 --- a/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java +++ b/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java @@ -690,7 +690,8 @@ private void initProperties(String requesterAgencyId, String baseUrl) throws Exc //LOOKUP LOCATION DOESN'T WORK UNLESS THE LOCATION CODE //IS SURROUNDED BY QUOTES if (lookupValue.contains("/")) lookupValue = '"' + lookupValue + '"'; - url = url.replace("{lookup}", StringUtil.cqlEncode(lookupValue)); + url = url.replace("{lookup}", PercentCodec.encode(lookupValue)); + final String timeoutString = System.getProperty(Constants.SERVICE_MGR_TIMEOUT,Constants.DEFAULT_TIMEOUT); int timeout = Integer.parseInt(timeoutString); @@ -781,10 +782,13 @@ public JsonObject lookupPatronRecordBy(String type, String value) throws Excepti if (!validTypes.contains(type)) { throw new Exception("invalid patron lookup type provided: " + type); } + + if (type != null && type.equalsIgnoreCase("externalSystemId")) type = "externalSystemId"; value = StringUtil.cqlEncode(value); String baseUrl = okapiHeaders.get(Constants.X_OKAPI_URL); - String query = "(" + type + "==" + value + "&limit=1"; - String userApiUri = baseUrl + "/users?query=" + PercentCodec.encode(query.toString()); + String query = "(" + type + "==" + value + ")"; + String userApiUri = baseUrl + "/users?query=" + PercentCodec.encode(query.toString()) + "&limit=1"; + String response = callApiGet(userApiUri); // WAS THE PATRON FOUND? diff --git a/src/main/java/org/folio/ncip/NcipConfigCheck.java b/src/main/java/org/folio/ncip/NcipConfigCheck.java index 065e989..c06663e 100644 --- a/src/main/java/org/folio/ncip/NcipConfigCheck.java +++ b/src/main/java/org/folio/ncip/NcipConfigCheck.java @@ -88,7 +88,7 @@ public void process(RoutingContext routingContext) throws Exception { logger.info(" using lookup value "); logger.info(value); if (value.contains("/")) value = '"' + value + '"'; - url = url.replace("{lookup}", StringUtil.cqlEncode(value)); + url = url.replace("{lookup}", PercentCodec.encode(value)); logger.info("WILL LOOKUP " + lookup + " WITH URL " + url + " USING VALUE " + value);