0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Fixed gh-count-down-html-characters helper to support null values

no issue

The default null value for the sigup terms caused an error. This fixes that issue.
This commit is contained in:
Simon Backx 2023-04-11 17:49:00 +02:00
parent b149ed79ae
commit c3c2427992

View file

@ -4,6 +4,11 @@ import {helper} from '@ember/component/helper';
export default helper(function (params) {
let [content, maxCharacters] = params;
if (!content) {
// Protect against NULL content
content = '';
}
// Strip HTML-tags and characters from content so we have a reliable character count
content = content.replace(/<[^>]*>?/gm, '');
content = content.replace(/&nbsp;/g, ' ');