api: rewrite article urls at the very end to prevent plugins which expect source URLs from breaking
This commit is contained in:
parent
52a86c5e38
commit
868b9b476e
|
@ -754,8 +754,6 @@ class API extends Handler {
|
|||
} else {
|
||||
$headline_row["content"] = $line["content"];
|
||||
}
|
||||
|
||||
$headline_row["content"] = DiskCache::rewriteUrls($headline_row['content']);
|
||||
}
|
||||
|
||||
// unify label output to ease parsing
|
||||
|
@ -776,15 +774,12 @@ class API extends Handler {
|
|||
$headline_row["note"] = $line["note"];
|
||||
$headline_row["lang"] = $line["lang"];
|
||||
|
||||
if ($show_content) {
|
||||
$hook_object = ["headline" => &$headline_row];
|
||||
|
||||
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API,
|
||||
function ($result) use (&$headline_row) {
|
||||
$headline_row = $result;
|
||||
},
|
||||
$hook_object);
|
||||
|
||||
list ($flavor_image, $flavor_stream, $flavor_kind) = Article::get_article_image($enclosures, $line["content"], $line["site_url"]);
|
||||
list ($flavor_image, $flavor_stream, $flavor_kind) = Article::get_article_image($enclosures,
|
||||
$line["content"], // unsanitized
|
||||
$line["site_url"]);
|
||||
|
||||
$headline_row["flavor_image"] = $flavor_image;
|
||||
$headline_row["flavor_stream"] = $flavor_stream;
|
||||
|
@ -793,6 +788,15 @@ class API extends Handler {
|
|||
if ($flavor_kind)
|
||||
$headline_row["flavor_kind"] = $flavor_kind;
|
||||
|
||||
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API,
|
||||
function ($result) use (&$headline_row) {
|
||||
$headline_row = $result;
|
||||
},
|
||||
$hook_object);
|
||||
|
||||
$headline_row["content"] = DiskCache::rewriteUrls($headline_row['content']);
|
||||
}
|
||||
|
||||
array_push($headlines, $headline_row);
|
||||
}
|
||||
} else if (is_numeric($result) && $result == -1) {
|
||||
|
|
Loading…
Reference in New Issue