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

add_group_labels=true fails to create JIRA if any label value has a space #181

Open
twotired opened this issue Nov 29, 2023 · 0 comments
Open

Comments

@twotired
Copy link
Contributor

level=debug ts=2023-11-29T04:34:23.792222111Z caller=notify.go:426 msg=handleJiraErrResponse api=Issue.Create err="request failed. Please analyze the request body for more details. Status code: 400" url=https://jira.example.com/rest/api/2/issue
level=error ts=2023-11-29T04:34:23.79259245Z caller=main.go:180 msg="error handling request" statusCode=400 statusText="Bad Request" err="JIRA request https://jira.example.com/rest/api/2/issue returned status 400 , error \"request failed. Please analyze the request body for more details. Status code: 400\", body \"{\\\"errorMessages\\\":[],\\\"errors\\\":{\\\"labels\\\":\\\"The label 'reason=\\\\\\\"descriptive error message\\\\\\\"' contains spaces which is invalid.\\\"}}\"" receiver=jiralert groupLabels="unsupported value type"

Fixes could include:

  1. skip labels with values that have invalid characters
  2. replace invalid characters with '_'
	if r.conf.AddGroupLabels {
		for k, v := range data.GroupLabels {
			issue.Fields.Labels = append(issue.Fields.Labels, fmt.Sprintf("%s=%.200q", k, v))
		}
	}
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