View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0034348 | mantisbt | api rest | public | 2024-03-22 16:04 | 2024-05-12 12:34 |
Reporter | acoder2020 | Assigned To | dregad | ||
Priority | normal | Severity | block | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | MantisBT 2.26.0 | OS | RHEL | OS Version | 8 |
Target Version | 2.26.2 | Fixed in Version | 2.26.2 | ||
Summary | 0034348: Adding issue note with REST API returns HTTP 500 when given view_state is invalid | ||||
Description | Failed to add comments to MantisBT under Mantis BugID 188. HTTP Code: 500 at line 63 Response: The application could not run because of the following error:
| ||||
Steps To Reproduce | Ran the following code:
| ||||
Additional Information | I haven't been able to successfully post a comment yet. I can post issues with attachments and custom fields with REST API just not comments. | ||||
Tags | No tags attached. | ||||
The problem is that you're passing view_state as an integer, it should be an array That being said, the API should not be throwing a 500 error in this case, but 400 BAD REQUEST. |
|
Very separately could the formatting be fixed in this particular bug comments section? I'd submit a report if I knew how to do that with the bug interface specifically. |
|
Changing
to
Fixed this issue for me. |
|
Thanks for confirming. Once the pull request gets merged, the API will fail more gracefully (i.e. you'll get a 400 error with a meaningful error message, i.e. Invalid view state).
I'm sorry I do not understand what you mean. Can you please clarify ? |
|
The formatting is off in your initial reply above: "The problem is that you're passing view_state as an integer, it should be an array "view_state": { "name": "public" } or if you want to work by value "view_state": { "id": 10 }." |
|
Is it possible to send an array of multiple comments at once, rather than posting each individual note one at a time? |
|
It would be great to have the same editor formatting tools here in this bug section as we do in MantisBT proper. More so here, so we can better format and highlight text to help explain. |
|
I suppose you mean the display of JSON as If so, this is a known, long-standing bug with our Markdown formatting, which converts < to
The REST API currently does not allow this, but you're welcome to file a new Issue to track this feature request, and even better submit a pull request with a proposed implementation.
Sorry but I still don't get it. What do you mean by "MantisBT proper" ? There are no formatting tools or WYSIWIG editor in MantisBT, we just use plain HTML textarea elements, in which you can type Markdown text to have it formatted. |
|
like this: |
|
MantisBT: master-2.26 9e7617de 2024-03-24 11:29 Details Diff |
Fix invalid view_state handling when adding bugnote Remove array type on $p_view_state parameter which was causing a PHP TypeError when REST API client was providing an unexpected value. Throw a ClientException if $p_view_state is not an array. Fixes 0034348 |
Affected Issues 0034348 |
|
mod - core/helper_api.php | Diff File |