diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-06-01 22:50:33 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-06-01 22:50:33 +0200 |
commit | fcad69a427de7ce4f65cbf53bcf778e561959807 (patch) | |
tree | 00f7fb88c0a396c03fcd5d0b1744f96f862d0371 /src | |
parent | 590151680538ea1edfef9053da476cd92c6944c4 (diff) | |
download | wallabag-fcad69a427de7ce4f65cbf53bcf778e561959807.tar.gz wallabag-fcad69a427de7ce4f65cbf53bcf778e561959807.tar.zst wallabag-fcad69a427de7ce4f65cbf53bcf778e561959807.zip |
Replace images with &
Images with `&` in the path weren’t well replaced because they might be with `&` in the html instead.
Replacing `&` with `&` fix the problem.
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/DownloadImages.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php index 0d330d2a..f7c26a38 100644 --- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php | |||
@@ -66,6 +66,12 @@ class DownloadImages | |||
66 | continue; | 66 | continue; |
67 | } | 67 | } |
68 | 68 | ||
69 | // if image contains "&"" and we can't find it in the html | ||
70 | // it might be because it's encoded as & | ||
71 | if (false !== stripos($image, '&') && false === stripos($html, $image)) { | ||
72 | $image = str_replace('&', '&', $image); | ||
73 | } | ||
74 | |||
69 | $html = str_replace($image, $imagePath, $html); | 75 | $html = str_replace($image, $imagePath, $html); |
70 | } | 76 | } |
71 | 77 | ||
@@ -114,7 +120,7 @@ class DownloadImages | |||
114 | $ext = $this->mimeGuesser->guess($res->getHeader('content-type')); | 120 | $ext = $this->mimeGuesser->guess($res->getHeader('content-type')); |
115 | $this->logger->debug('DownloadImages: Checking extension', ['ext' => $ext, 'header' => $res->getHeader('content-type')]); | 121 | $this->logger->debug('DownloadImages: Checking extension', ['ext' => $ext, 'header' => $res->getHeader('content-type')]); |
116 | if (!in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) { | 122 | if (!in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) { |
117 | $this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping '.$imagePath); | 123 | $this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping: '.$imagePath); |
118 | 124 | ||
119 | return false; | 125 | return false; |
120 | } | 126 | } |