View Issue Details

IDProjectCategoryView StatusLast Update
0025996mantisbtapi restpublic2019-08-14 10:24
Reporterdregad Assigned Todregad  
PrioritynormalSeveritytweakReproducibilityalways
Status assignedResolutionopen 
Product Version2.5.0 
Target Version2.22.0Fixed in Version 
Summary0025996: Missing tag name in error message when creating issue via REST API
Description

When creating a new issue via REST API with a non-existing tag name, the error message does not include the tag name, which makes it harder to troubleshoot the problem in the payload.

Steps To Reproduce
$ curl --location -w "%{http_code}" --request POST "http://path/to/mantisbt/api/rest/issues/"   --header "Authorization: XXXX"   --header "Content-Type: application/json"   --data "{
  \"summary\": \"Test add issue with tags $(date +%T)\",
  \"description\": \"Test description\",
  \"category\": {
    \"name\": \"General\"
  },
  \"project\": {
    \"name\": \"Test project\"
  }, \"tags\": [ { \"name\": \"xxxx\" }, {} ]
}"

Yields

{"message":"Tag  not found.","code":2200,"localized":"Could not find a tag with that name."}
                ^
                tag name expected here
Additional Information

This problem was also identified by @vboctor in https://github.com/mantisbt/mantisbt/pull/1391#issuecomment-426497674

An orthogonal issue we have is that the tag not found error doesn't include the tag name that isn't found. I haven't changed that as part of this change since this the issue targeted by this issue.

TagsNo tags attached.

Relationships

related to 0024774 closedvboctor Error Creating Issue with new TAG 

Activities

dregad

dregad

2019-08-14 09:00

developer   ~0062567

Last edited: 2019-08-14 09:02

View 3 revisions

The same problem occurs if the user attempting to create the issue does not have the required privileges to create tags, as the code references an undefined $t_new_tag variable.

{"message":"User '41782' can't create tag ''.","code":2200,"localized":"Could not find a tag with that name."}
                                           ^ 
                                           tag name expected here
dregad

dregad

2019-08-14 10:24

developer   ~0062569

PR https://github.com/mantisbt/mantisbt/pull/1542

Issue History

Date Modified Username Field Change
2019-08-14 07:09 dregad New Issue
2019-08-14 07:09 dregad Status new => assigned
2019-08-14 07:09 dregad Assigned To => dregad
2019-08-14 08:37 dregad Description Updated View Revisions
2019-08-14 08:37 dregad Additional Information Updated View Revisions
2019-08-14 09:00 dregad Note Added: 0062567
2019-08-14 09:01 dregad Relationship added related to 0024774
2019-08-14 09:02 dregad Note Edited: 0062567 View Revisions
2019-08-14 09:02 dregad Note Edited: 0062567 View Revisions
2019-08-14 10:24 dregad Note Added: 0062569