diff options
author | Maryana Rozhankivska <mariroz@mr.lviv.ua> | 2014-06-25 20:00:00 +0300 |
---|---|---|
committer | Maryana Rozhankivska <mariroz@mr.lviv.ua> | 2014-06-25 20:00:00 +0300 |
commit | 692425342317277090f4c03f36d114eab3742340 (patch) | |
tree | 3baad4dd24db18df642bda284a6a64ba7875b802 /inc | |
parent | aa126ba458a02e8b1e43b15fc28f550ee72a9619 (diff) | |
download | wallabag-692425342317277090f4c03f36d114eab3742340.tar.gz wallabag-692425342317277090f4c03f36d114eab3742340.tar.zst wallabag-692425342317277090f4c03f36d114eab3742340.zip |
fix of issue #677: When downloading images, wallabag doesnt respect html "base" tag, tnx to @fivefilters
Diffstat (limited to 'inc')
-rwxr-xr-x | inc/3rdparty/makefulltextfeed.php | 6 | ||||
-rwxr-xr-x | inc/3rdparty/makefulltextfeedHelpers.php | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/inc/3rdparty/makefulltextfeed.php b/inc/3rdparty/makefulltextfeed.php index 62c050ec..a081f88b 100755 --- a/inc/3rdparty/makefulltextfeed.php +++ b/inc/3rdparty/makefulltextfeed.php | |||
@@ -671,7 +671,11 @@ foreach ($items as $key => $item) { | |||
671 | $html .= $item->get_description(); | 671 | $html .= $item->get_description(); |
672 | } else { | 672 | } else { |
673 | $readability->clean($content_block, 'select'); | 673 | $readability->clean($content_block, 'select'); |
674 | if ($options->rewrite_relative_urls) makeAbsolute($effective_url, $content_block); | 674 | // get base URL |
675 | $base_url = get_base_url($readability->dom); | ||
676 | if (!$base_url) $base_url = $effective_url; | ||
677 | // rewrite URLs | ||
678 | if ($options->rewrite_relative_urls) makeAbsolute($base_url, $content_block); | ||
675 | // footnotes | 679 | // footnotes |
676 | if (($links == 'footnotes') && (strpos($effective_url, 'wikipedia.org') === false)) { | 680 | if (($links == 'footnotes') && (strpos($effective_url, 'wikipedia.org') === false)) { |
677 | $readability->addFootnotes($content_block); | 681 | $readability->addFootnotes($content_block); |
diff --git a/inc/3rdparty/makefulltextfeedHelpers.php b/inc/3rdparty/makefulltextfeedHelpers.php index 4e985372..ac872ab8 100755 --- a/inc/3rdparty/makefulltextfeedHelpers.php +++ b/inc/3rdparty/makefulltextfeedHelpers.php | |||
@@ -377,3 +377,13 @@ function debug($msg) { | |||
377 | flush(); | 377 | flush(); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | |||
381 | function get_base_url($dom) { | ||
382 | $xpath = new DOMXPath($dom); | ||
383 | $base_url = @$xpath->evaluate('string(//head/base/@href)', $dom); | ||
384 | if ($base_url !== '') { | ||
385 | return $base_url; | ||
386 | } else { | ||
387 | return false; | ||
388 | } | ||
389 | } | ||