Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go的sdk,签名不支持query中带有空格 #15

Open
milkmeowo opened this issue Jan 5, 2021 · 0 comments
Open

go的sdk,签名不支持query中带有空格 #15

milkmeowo opened this issue Jan 5, 2021 · 0 comments

Comments

@milkmeowo
Copy link

问题

go的sdk,签名不支持query中带有空格,例如query=default:'测试' AND tag:'1'

表现

1、如果我自行url encode,开放搜索会提是错误6604:Query parse failed

// query=default:'测试' AND tag:'1'
{
    "errors": [
        {
            "code": 4003,
            "message": "Signature fail",
            "params": {}
        }
    ],
    "status": "FAIL",
    "request_id": "160931705716780264679308"
}

2、如果我不对空格url encode,【sdk签名时】会转成+导致签名错误

// query=default:'测试'%20AND%20tag:'1'
{
    "errors": [
        {
            "code": 6604,
            "message": "Query parse failed, query[default:'测试'%20AND%20tag:'1']"
        }
    ]
}

原因

https://github.com/alibabacloud-go/opensearch-util/blob/f85abd70ca6464adad9e1b25f635ee54ce2759e9/service/service.go#L66-L76

url.QueryEscape之后空格变成了+导致和开放搜索的签名结果不一致。

尝试修复PR

alibabacloud-go/opensearch-util#1

+转换成%20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant