mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #1744 from omnivore-app/fix/wechat-image
Fix not showing images in wechat articles
This commit is contained in:
commit
c3e6321b3d
1 changed files with 5 additions and 1 deletions
|
|
@ -526,7 +526,8 @@ Readability.prototype = {
|
|||
// replace all images' href source
|
||||
const images = articleContent.getElementsByTagName('img');
|
||||
Array.from(images).forEach(image => {
|
||||
const src = image.getAttribute("src");
|
||||
// use data-src if lazy loading
|
||||
const src = image.getAttribute("data-src") || image.getAttribute("src");
|
||||
|
||||
// do not proxy data uri
|
||||
if (src && !dataUriRegex.test(src)) {
|
||||
|
|
@ -545,6 +546,9 @@ Readability.prototype = {
|
|||
const proxySrc = this.createImageProxyUrl(absoluteSrc, width, height);
|
||||
image.setAttribute('src', proxySrc);
|
||||
}
|
||||
|
||||
// remove crossorigin attribute to avoid CORS errors
|
||||
image.removeAttribute('crossorigin');
|
||||
});
|
||||
|
||||
// replace all srcset's
|
||||
|
|
|
|||
Loading…
Reference in a new issue