MantisBT: master b444fefc

Author Committer Branch Timestamp Parent
dregad dregad master 2026-09-05 10:28 master 604a1cd4
Affected Issues  0037370: Misleading error message when trying to delete non-existing attachment via SOAP API
Changeset

IssuefileDeleteCommand: accept empty issue id

Requiring it makes no sense from SOAP API (mc_issue_attachment_delete()
function) or the Web UI (bug_file_delete.php) contexts, because the
issue id is unknown to the caller, forcing them to retrieve it using
file_get_field().

Problem, file_get_field() returns false when the given id does not
exist, so error handling would be required but that is currently not
implemented, and the command's validate() returns a misleading error
message: "'issue_id' missing".

Refactor validate() method to retrieve issue_id from the file record
when it is not provided or blank, and return a meaningful error message
if not found. If issue_id is given (i.e. from REST API), behavior is u
nchanged.

Adapt mc_issue_attachment_delete() and bug_file_delete.php: remove
unnecessary file_get_field() call and do not pass issue_id to Command.

Fixes 0037370

mod - api/soap/mc_issue_attachment_api.php Diff File
mod - bug_file_delete.php Diff File
mod - core/commands/IssueFileDeleteCommand.php Diff File