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

path is inconsistent when use non-English letters #184

Closed
lzh-lab opened this issue May 8, 2021 · 1 comment
Closed

path is inconsistent when use non-English letters #184

lzh-lab opened this issue May 8, 2021 · 1 comment

Comments

@lzh-lab
Copy link
Contributor

lzh-lab commented May 8, 2021

func (r *CortexClient) CreateRuleGroup(ctx context.Context, namespace string, rg rwrulefmt.RuleGroup) error {
payload, err := yaml.Marshal(&rg)
if err != nil {
return err
}
escapedNamespace := url.PathEscape(namespace)
path := r.apiPath + "/" + escapedNamespace
res, err := r.doRequest(path, "POST", payload)
if err != nil {
return err
}
res.Body.Close()
return nil
}
// DeleteRuleGroup creates a new rule group
func (r *CortexClient) DeleteRuleGroup(ctx context.Context, namespace, groupName string) error {
escapedNamespace := url.PathEscape(namespace)
escapedGroupName := url.PathEscape(groupName)
path := r.apiPath + "/" + escapedNamespace + "/" + escapedGroupName
res, err := r.doRequest(path, "DELETE", nil)
if err != nil {
return err
}
res.Body.Close()
return nil
}

Delete use escaped group name and Create not.

@lzh-lab
Copy link
Contributor Author

lzh-lab commented May 8, 2021

Example:

Create: http://host:port/api/v1/rules/metric/啊啊 => /api/v1/rules/metric/%E5%95%8A%E5%95%8A
Delete: http://host:port/api/v1/rules/metric/啊啊 => /api/v1/rules/metric/%25E5%2595%258A%25E5%2595%258A

url.PathEscape(啊啊) => %E5%95%8A%E5%95%8A
url.PathEscape(url.PathEscape(啊啊)) => %25E5%2595%258A%25E5%2595%258A

@lzh-lab lzh-lab closed this as completed May 8, 2021
friedrichg pushed a commit to cortexproject/cortex-tools that referenced this issue Aug 1, 2023
Signed-off-by: Tom Hayward <thayward@infoblox.com>
friedrichg pushed a commit to cortexproject/cortex-tools that referenced this issue Aug 1, 2023
…na#180)

* adding optional auth-org generation code

Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* Added documentation

Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* Bumping version number

Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* Un-Bumping version number

Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* Adding changelog description

Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* added alertmanager-config example, added value attributes (grafana#181)

Signed-off-by: Raphael Grömmer <r.groemmer@yahoo.de>
Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* Passing DCO test one hopes

Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* update docs also in the tmpl file (grafana#186)

Signed-off-by: ShuzZzle <niclas.schad@gmail.com>
Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* add autoscaler for ingesters (grafana#182)

Signed-off-by: Tom Hayward <thayward@infoblox.com>
Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* define namespace in templates (grafana#184)

Signed-off-by: Tom Hayward <thayward@infoblox.com>
Signed-off-by: Jeff Kolb <jeff.kolb@intlfcstone.com>

* fix: documentation to match helm-docs spec

Signed-off-by: ShuzZzle <niclas.schad@gmail.com>

* fix: auth_orgs under wrong section and use %d for http listen port

Signed-off-by: ShuzZzle <niclas.schad@gmail.com>

Co-authored-by: Raphael Grömmer <38243306+rgroemmer@users.noreply.github.com>
Co-authored-by: Niclas Schad <niclas.schad@gmail.com>
Co-authored-by: Tom Hayward <thayward@infoblox.com>
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