A body might contain embedded entities that need to be transformed by the AMP library, including media entities, but currently the library is used before the filters have been applied. This means that if embedded entities contain images or other items that need to be transformed, they won't be.

We need to update this processing so it happens in this order:

  1. Transform any embedded entities in the body (and any other changes the filter system wants to make)
  2. Apply the AMP library transformations to the updated body markup.

In addition, when we use '#markup', we also need to pass '#allowed_tags' with a list of the AMP tags in the text. Without this step, Drupal's sanitization will still strip the AMP markup out of the result.

Patch coming.

Comments

KarenS created an issue. See original summary.

karens’s picture

Status: Active » Needs review
StatusFileSize
new0 bytes

Patch.

karens’s picture

StatusFileSize
new5.57 KB

The last submitted patch, 2: 3017398-amp-processing-order.patch, failed testing. View results

karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes

  • KarenS committed ee313b8 on 8.x-3.x
    Issue #3017398 by KarenS: Fix handling of embedded entities
    
karens’s picture

StatusFileSize
new23.13 KB

Add tests for the transformation of images in the body, which indicated that #allowed_tags has to be expanded using the Xss allowed tags list.

karens’s picture

Title: Fix handling of embedded entities » Fix handling of embedded images and entities

Expand on the title.

  • KarenS committed 7c814fa on 8.x-3.x
    Issue #3017398 by KarenS: Fix handling of embedded images and entities,...
karens’s picture

Status: Needs review » Fixed

Will probably add more tests later, but seems to be working.

Status: Fixed » Closed (fixed)

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