Invalid HTML in Mail Body results in obscure errors

Created on 21 April 2023, over 1 year ago

Problem/Motivation

Because the "Mail Body" editing field accepts HTML but is not WYSIWYG and bypasses the filters, users who are not HTML savvy can make simple typos in the templates that result in a WSOD and obscure errors like

Drupal\Core\Entity\EntityStorageException: The user-entered string '”https://example.com' must begin with a '/', '?', or '#'. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Steps to reproduce

Edit a PET template, and in the Mail Body field, enter a link with a curly quote in place of a straight quote, such as
<a href=“https://example.com">link text</a>
Attempt to send an email with that template. The log will show an error message like the one quoted above.

Proposed resolution

Ideally, the Mail Body field would use Drupal core's WYSIWYG editor and text filters. Failing that, some sort of validation check on the form could display an error if HTML tags contain non-HTML-safe characters.

Remaining tasks

Make a fork or patch.

User interface changes

Either implement core editing functionality or add a validation check to the form.

Feature request
Status

Active

Version

4.0

Component

Code

Created by

🇺🇸United States BenStallings

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024