Resolve relative URLs (assuming URI.Base==notice URL)

The real way to do this would be to get the xml:base property from
the Atom feed but it's probably not there in any posts we see today.
This commit is contained in:
Mikael Nordfeldth
2016-02-26 14:46:26 +01:00
parent 1e6520fddd
commit 52a3764ae4
2 changed files with 7 additions and 3 deletions

View File

@@ -854,8 +854,8 @@ class Notice extends Managed_DataObject
if (mb_strlen($content)===0 && !is_null($actobj)) {
$content = mb_strlen($actobj->content) ? $actobj->content : $actobj->summary;
}
// Strip out any bad HTML from $content
$stored->rendered = common_purify($content);
// Strip out any bad HTML from $content. URI.Base is used to sort out relative URLs.
$stored->rendered = common_purify($content, ['URI.Base' => $stored->url ?: null]);
$stored->content = common_strip_html($stored->getRendered(), true, true);
if (trim($stored->content) === '') {
// TRANS: Error message when the plain text content of a notice has zero length.