diff --git a/src/document/renderer.c b/src/document/renderer.c index 99d21dcb6..a2eda30f2 100644 --- a/src/document/renderer.c +++ b/src/document/renderer.c @@ -125,6 +125,25 @@ render_encoded_document(struct cache_entry *cached, struct document *document) render_plain_document(cached, document, &buffer); } else { +#if defined(CONFIG_KITTY) || defined(CONFIG_LIBSIXEL) + if (!c_strcasecmp("image/png", cached->content_type) + || !c_strcasecmp("image/jpg", cached->content_type) + || !c_strcasecmp("image/jpeg", cached->content_type)) { + struct string img; + + if (init_string(&img)) { + add_format_to_string(&img, "", struri(cached->uri)); + + if (encoding != ENCODING_NONE) { + done_string(&buffer); + } + encoding = ENCODINGS_KNOWN; + buffer.source = img.source; + buffer.length = img.length; + } + } +#endif + #ifdef CONFIG_DOM if (cached->content_type && (!c_strlcasecmp("application/rss+xml", 19, cached->content_type, -1))) @@ -137,7 +156,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document) else #ifdef CONFIG_LIBDOM if (1) { - if (encoding != ENCODING_NONE) { + if (encoding != ENCODING_NONE && encoding != ENCODINGS_KNOWN) { done_string(&buffer); encoding = ENCODING_NONE; } diff --git a/src/session/download.c b/src/session/download.c index fdea6571b..8f29e7f1a 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -1958,6 +1958,11 @@ struct { { "application/xbel+xml", 1 }, { "application/xbel", 1 }, { "application/x-xbel", 1 }, +#endif +#if defined(CONFIG_KITTY) || defined(CONFIG_LIBSIXEL) + { "image/png", 0 }, + { "image/jpg", 0 }, + { "image/jpeg", 0 }, #endif { NULL, 1 }, };