MantisBT: master 0faf5a5c

Author Committer Branch Timestamp Parent
dregad dregad master 2025-09-17 13:01 master-2.27 e200fc11
Affected Issues  0036303: Uploading a file when $g_antispam_max_event_count has been reached causes Dropzone to display HTML code
Changeset

Prevent HTML output in Dropzone when errors occur

A somewhat hackish solution, leveraging the existing behavior in the
error handler, driven by the DISABLE_INLINE_ERROR_REPORTING constant.

When bug_report.php or bugnote_add.php are called via AJAX (as is the
case when Dropzone handles file uploads), the constant is set with a new
value of text. This is picked up by error_handler(), which sends the
error message in the response body as plain text.

Note: AJAX detection relies on presence of non-standard X-Requested-With
header with value 'XMLHttpRequest' (which is set by Dropzone 1).

Fixes 0036303

mod - bug_report.php Diff File
mod - bugnote_add.php Diff File
mod - core/error_api.php Diff File