Problem/Motivation

The button to open the modal window with the taxonomy tree breaks if it finds any HTML elements in the path, causing an Ajax 404 error.
If $dialog_title has any HTML elements such as strong, span, em, etc., it breaks the URL and causes a 404 error.

Context: After applying this community patch https://www.drupal.org/files/issues/2025-08-13/fix-wrong-parameter-type-... (3538860 - TypeError: preg_match(): Argument #2 ($subject) must be of type string...) the modal window stopped working, giving a 404 error when trying to open the window.

Steps to reproduce

  • Add the mentioned patch
  • Try to open the modal window
  • See the error
Message error:
Uncaught 
Object { message: '\nAn AJAX HTTP error occurred.\nHTTP Result Code: 404\nDebugging information follows.\nPath: /admin/entity_reference_tree/search/edit-field-user-roles-0-target-id/user_roles/taxonomy_term/default/0?limit=-1\nStatusText: error\nResponseText: {"message":"No route found for \\u0022POST https:\\/\\/site.com\\/admin\\/entity_reference_tree\\/search\\/edit-field-user-roles-0-target-id\\/name\\/taxonomy_term\\/default\\/0\\u0022 (from \\u0022https:\\/\\/site.com\\/node\\/118\\/edit?destination=\\/admin\\/content\\u0022)"}', name: "AjaxError", stack: etc...

Proposed resolution

Comments

andreadruiz created an issue. See original summary.

andreadruiz’s picture

Issue summary: View changes
andreadruiz’s picture

StatusFileSize
new681 bytes

Adding this patch to solve the issue (remove the HTML tags that could break the URL in the modal window).

andreadruiz’s picture

Status: Active » Needs review

  • mingsong committed 6b7df537 on 2.x
    fix: #3572678 Dialog title with HTML tags causes AJAX 404 error in modal...
mingsong’s picture

Status: Needs review » Fixed

Thanks.

Fixed with 2.4.2

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.