Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The default configuration allows some html tags to be used in the aggregated content. However, I just realized that these tags do not get automatically closed if the truncated version shortens the content before the closing tag of the actual content.
<div class="feed-item">
<h3 class="feed-item-title">
<a href="feed url" target="feeditems">Feed item title</a>
</h3>
<div class="feed-item-body">
<p>some text which then ends with <strong>April 27-29, 201... </div>
<div class="feed-item-categories">
Categories: <a href="/aggregator/categories/2">Faculty News</a> </div>
</div>
Can't the content be checked for open tags with regular expressions and then closing tags could be added at the end of the feed item body? I unfortunately do not know regular expressions enough to suggest a solution, but I guess when the content is cleaned for non-allowed tags, it could make this extra check?
Cheers, J.
Comments
Comment #1
ParisLiakos CreditAttribution: ParisLiakos commentedNot sure if this bug exists in d8, but if yes, it should be fixed there first
Comment #10
pameeela CreditAttribution: pameeela commentedI thought that this would be the same as #2714131: Trimmed body display format can result in faulty and chopped off HTML if "Correct faulty and chopped off HTML" is not activated on the text format and it just needed the 'Correct faulty or chopped off HTML' filter applied, but I can't reproduce it in 9.3. The issue occurs on the home page but not in the feed.
Markup in the body is:
<p><strong><em><a href="/">Text formats define how text is filtered for output and how HTML tags and other text is displayed, replaced, or removed. Improper text format configuration is a security risk. Learn more on the Filter module help page.</a></em></strong></p>
This gets output as trimmed to 100 characters in the feed with closing tags added:
But since this is logged against aggregator maybe I'm misunderstanding. Surely though we won't be cleaning up content from outside sources?
Comment #11
longwaveI can't see where aggregator ever truncated the body text of an item - back in D6 it would truncate the title, but not the description field, of an imported feed. I think as this is so old and nobody has reported it since we should just close this.
Comment #12
pameeela CreditAttribution: pameeela commentedWorks for me :)