Problem/Motivation

In the JSON Feed v1 spec, it states in the entry for content_html:

Important: the only place HTML is allowed in this format is in content_html.

However, a Drupal user could configure a view (either intentionally or unintentionally) to output HTML for other fields like title.

Proposed resolution

We can either validate this at view configuration time or strip HTML for the appropriate fields at render time. I am leaning towards the latter.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

markdorison created an issue. See original summary.

markdorison’s picture

Issue tags: +Needs tests
KarlShea’s picture

I am leaning towards the latter.

I agree, I think the less configuration/knowledge someone needs to have about the spec the better.

KarlShea’s picture

Status: Active » Needs review
FileSize
2.65 KB

I'm not sure which direction to go here. I don't like using check_markup(), because that just escapes HTML and I don't think that's what anyone would want. The patch uses strip_tags(), which works, but maybe MailFormatHelper::htmlToText would be better? The problem with that is it looks like it does way more that's mail-specific than would be desired here.

markdorison’s picture

Assigned: Unassigned » markdorison
markdorison’s picture

@KarlShea I am thinking 'strip_tags' is the best approach.

There are a number of ways to approach this but here is one.

markdorison’s picture

Status: Needs review » Needs work

Needs re-roll.

markdorison’s picture

Status: Needs work » Needs review
FileSize
8.01 KB

  • KarlShea committed 964486e on 8.x-1.x authored by markdorison
    Issue #2885052 by markdorison, KarlShea: Attributes that should not...
KarlShea’s picture

Status: Needs review » Fixed

Looks good

Status: Fixed » Closed (fixed)

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