go-jira icon indicating copy to clipboard operation
go-jira copied to clipboard

Empty issue key causes misleading error

Open romshark opened this issue 4 years ago • 1 comments

Describe the bug

https://github.com/andygrunwald/go-jira/blob/v1.13.0/issue.go#L806 accepts empty issue keys which causes the resulting error to be:

405 Method Not Allowed: : request failed. Please analyze the request body for more details. Status code: 405

To Reproduce

  1. call (*IssueService).Update with no issue key set.

Expected behavior

Should return errors.New("invalid issue key")

Possible Solution

Validate the issue key before formatting:

if err := ValidateIssueKey(issue.Key); err != nil {
  return err
}
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", issue.Key)
//...

Your Environment

  • go-jira version (git tag or sha): v.1.13.0
  • Go version (go version): go version go1.16.5 darwin/amd64

Additional context

The error 405 Method Not Allowed is misleading and doesn't reflect the actual error! Update shouldn't accept empty issue keys at all! I suppose this isn't the only place in the code where similar things happen?

romshark avatar Jun 15 '21 14:06 romshark

Hi! Thank you for taking the time to create your first issue! Really cool to see you here for the first time. Please give us a bit of time to review it.

github-actions[bot] avatar Jun 15 '21 14:06 github-actions[bot]

Hey,

I am very sorry that this issue has been open for a long time with no final solution. We work on this project in our spare time, and sometimes, other priorities take over. This is the typical open source dilemma.

However, there is news: We are kicking off v2 of this library 🚀

To provide visibility, we created the Road to v2 Milestone and calling for your feedback in https://github.com/andygrunwald/go-jira/issues/489

The development will take some time; however, I hope you can benefit from the changes. If you seek priority development for your issue + you like to sponsor it, please contact me.

What does this mean for my issue?

We will work on this issue indirectly. This means that during the development phase, we aim to tackle it. Maybe in a different way like it is currently handled. Please understand that this will take a while because we are running this in our spare time.

Final words

Thanks for using this library. If there is anything else you would like to tell us, let us know!

andygrunwald avatar Aug 21 '22 14:08 andygrunwald