summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-07-27 07:24:47 +0300
committerAndrew Dolgov <[email protected]>2022-07-27 07:24:47 +0300
commitcbf710161d19a7cefcec08f49c0d481c62374204 (patch)
treeab0077e4fb4ecbae1967f509b4864b12cc5019b1 /plugins
parente507d006fdc1248a7386f7103504454745761f7d (diff)
af_redditimgur: absolutize links before working on them (again)
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/af_redditimgur/init.php30
1 files changed, 15 insertions, 15 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php
index 88768dac4..8a0d7d99e 100755
--- a/plugins/af_redditimgur/init.php
+++ b/plugins/af_redditimgur/init.php
@@ -653,10 +653,14 @@ class Af_RedditImgur extends Plugin {
/** @var ?DOMElement $content_link */
$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"];
$owner_uid = $article["owner_uid"];
@@ -682,20 +686,16 @@ class Af_RedditImgur extends Plugin {
if ($num_found > 0) $article["force_catchup"] = true;
}
}
- }
- if ($content_link && $this->is_blacklisted($content_link->getAttribute("href")))
- return $article;
+ $found = $this->inline_stuff($article, $doc, $xpath);
+ $node = $doc->getElementsByTagName('body')->item(0);
- $found = $this->inline_stuff($article, $doc, $xpath);
-
- $node = $doc->getElementsByTagName('body')->item(0);
-
- if ($node && $found) {
- $article["content"] = $doc->saveHTML($node);
- $article["enclosures"] = $this->generated_enclosures;
- } else if ($content_link) {
- $article = $this->readability($article, $content_link->getAttribute("href"), $doc, $xpath);
+ if ($node && $found) {
+ $article["content"] = $doc->saveHTML($node);
+ $article["enclosures"] = $this->generated_enclosures;
+ } else {
+ $article = $this->readability($article, $content_href, $doc, $xpath);
+ }
}
}
}