问题描述
使用SAP Cloud SDK JavaScript(@ sap-cloud-sdk /核心版本1.26.1,@ sap / cloud-sdk-vdm-product-service版本1.19.0)ODATA过滤器未在URL查询中进行百分比编码部分。
示例(假设存在描述为“ä_description”的产品)
以下示例未检索到此产品说明:
const term = 'ä_description';
const destination = getDestinationInformation(); //get destination information from somewhere
const results = await ProductDescription.requestBuilder()
.getAll()
.filter(ProductDescription.PRODUCT_DESCRIPTION.equals(term))
.execute(destination);
此代码段生成以下请求URL:
"https://<host>/sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductDescription?$format=json&$filter=(ProductDescription eq 'ä_description')"
对搜索词(const term = encodeURIComponent('ä_description');
)进行百分比编码时,会生成以下请求URL:
"https://<host>/sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductDescription?$format=json&$filter=(ProductDescription eq '%C3%A4_description')"
这将返回预期结果。
我没有检查,但这可能也会影响其他VDM软件包。
SDK本身或SDK用户应该执行URL编码吗?我想避免双重编码。
预先感谢
ujj