af_redditimgur: absolutize links before working on them (again)

This commit is contained in:
Andrew Dolgov 2022-07-27 07:24:47 +03:00
parent e507d006fd
commit cbf710161d
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
1 changed files with 15 additions and 15 deletions

View File

@ -653,10 +653,14 @@ class Af_RedditImgur extends Plugin {
/** @var ?DOMElement $content_link */ /** @var ?DOMElement $content_link */
$content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0); $content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);
if ($this->host->get($this, "enable_content_dupcheck")) { if ($content_link) {
$content_href = UrlHelper::rewrite_relative($article["link"], $content_link->getAttribute("href"), "a");
if ($this->is_blacklisted($content_href))
return $article;
if ($this->host->get($this, "enable_content_dupcheck")) {
if ($content_link) {
$content_href = $content_link->getAttribute("href");
$entry_guid = $article["guid_hashed"]; $entry_guid = $article["guid_hashed"];
$owner_uid = $article["owner_uid"]; $owner_uid = $article["owner_uid"];
@ -682,20 +686,16 @@ class Af_RedditImgur extends Plugin {
if ($num_found > 0) $article["force_catchup"] = true; if ($num_found > 0) $article["force_catchup"] = true;
} }
} }
}
if ($content_link && $this->is_blacklisted($content_link->getAttribute("href"))) $found = $this->inline_stuff($article, $doc, $xpath);
return $article; $node = $doc->getElementsByTagName('body')->item(0);
$found = $this->inline_stuff($article, $doc, $xpath); if ($node && $found) {
$article["content"] = $doc->saveHTML($node);
$node = $doc->getElementsByTagName('body')->item(0); $article["enclosures"] = $this->generated_enclosures;
} else {
if ($node && $found) { $article = $this->readability($article, $content_href, $doc, $xpath);
$article["content"] = $doc->saveHTML($node); }
$article["enclosures"] = $this->generated_enclosures;
} else if ($content_link) {
$article = $this->readability($article, $content_link->getAttribute("href"), $doc, $xpath);
} }
} }
} }