Show error if image is greater than max prefetch size

This commit is contained in:
Al McKinlay 2017-12-28 16:28:49 +00:00 committed by Jérémie Astori
parent 6b024191c1
commit 335bd803af
No known key found for this signature in database
GPG key ID: B9A4F245CD67BDE8
2 changed files with 12 additions and 4 deletions

View file

@ -28,5 +28,11 @@
<div class="body" title="{{body}}">{{body}}</div>
</a>
{{/equal}}
{{#equal type "error"}}
<a class="toggle-text" href="{{link}}" target="_blank" rel="noopener">
<div class="head" title="{{head}}">{{head}}</div>
<div class="body" title="{{body}}">{{body}}</div>
</a>
{{/equal}}
</div>
{{/preview}}

View file

@ -99,12 +99,14 @@ function parse(msg, preview, res, client) {
case "image/jpeg":
case "image/webp":
if (res.size > (Helper.config.prefetchMaxImageSize * 1024)) {
return;
preview.type = "error";
preview.head = "Large image";
preview.body = "Image is greater than your max image size. Click to view.";
} else {
preview.type = "image";
preview.thumb = preview.link;
}
preview.type = "image";
preview.thumb = preview.link;
break;
case "audio/midi":