mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-23 17:42:15 -05:00
Merge pull request #737 from mariroz/dev
fix of issue #677: When downloading images, wallabag doesnt respect html "base" tag, tnx to @fivefilters
This commit is contained in:
commit
cdda041a90
6
inc/3rdparty/makefulltextfeed.php
vendored
6
inc/3rdparty/makefulltextfeed.php
vendored
@ -671,7 +671,11 @@ foreach ($items as $key => $item) {
|
||||
$html .= $item->get_description();
|
||||
} else {
|
||||
$readability->clean($content_block, 'select');
|
||||
if ($options->rewrite_relative_urls) makeAbsolute($effective_url, $content_block);
|
||||
// get base URL
|
||||
$base_url = get_base_url($readability->dom);
|
||||
if (!$base_url) $base_url = $effective_url;
|
||||
// rewrite URLs
|
||||
if ($options->rewrite_relative_urls) makeAbsolute($base_url, $content_block);
|
||||
// footnotes
|
||||
if (($links == 'footnotes') && (strpos($effective_url, 'wikipedia.org') === false)) {
|
||||
$readability->addFootnotes($content_block);
|
||||
|
10
inc/3rdparty/makefulltextfeedHelpers.php
vendored
10
inc/3rdparty/makefulltextfeedHelpers.php
vendored
@ -377,3 +377,13 @@ function debug($msg) {
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
function get_base_url($dom) {
|
||||
$xpath = new DOMXPath($dom);
|
||||
$base_url = @$xpath->evaluate('string(//head/base/@href)', $dom);
|
||||
if ($base_url !== '') {
|
||||
return $base_url;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user