Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rich text fields munge html in view mode #21

Closed
eileenmcnaughton opened this issue Sep 13, 2018 · 4 comments
Closed

Rich text fields munge html in view mode #21

eileenmcnaughton opened this issue Sep 13, 2018 · 4 comments

Comments

@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented Sep 13, 2018

Here's a can of worms for ya!

Rich text fields - when edited normally save html to the database - here is what a field looks like in view mode when edited via an inbuilt form

screenshot 2018-09-13 12 51 48

Edited via the contactlayout block they save escaped html - so it looks like this

screenshot 2018-09-13 12 50 53

And here is how it renders when viewed on a 'normal' tab
screenshot 2018-09-13 12 52 54

This is how the field looks in the ContactEditor when it is submitted - ie straight after $values = $this->exportValues();

<p>&lt;p&gt;new stuff&lt;/p&gt;</p>
@nganivet
Copy link

Out of context: we recently gave up on trying to fix this same issue in the word replacement admin screen in core: the 'source' and 'replacement' fields have different behaviors with html inputs, making it impossible to enter a word replacement where either the source or replacement string includes html tags.

So most likely not an easy issue to deal with ...

@colemanw
Copy link
Member

This appears to be a system-wide problem, possibly caused by the latest round of security fixes. Not just profile forms but core forms are also struggling. Try this:

  • Edit a contact's last name to be I<i>am</i>html. Obviously html tags are not allowed in a last name field so the correct behavior is for them to be escaped and displayed literally as-is.
  • Now view the contact. Note that the last name is displayed correctly. It should read "I<i>am</i>html".
  • But if you click the name to edit, or click "Edit" for the whole contact, it will get garbled. The same problem happens if you stick last_name in a profile block.

@eileenmcnaughton
Copy link
Contributor Author

@colemanw FYI - editing the same data in the contact custom field block doesn't garble it - but there is a difference here - ie. I am specifically referring to fields that support html - as defined by their html type & data type. I did wonder if there should be a permission to be able to save html data fields since they are intrinsically insecure

@colemanw
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants