From 2dbfffb055a26003914d29c96fff2228964bd4d8 Mon Sep 17 00:00:00 2001 From: teddit Date: Fri, 1 Jan 2021 19:56:19 +0100 Subject: [PATCH] include enclosure only if thumbnail is present --- inc/teddit_api/handleSubreddit.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/inc/teddit_api/handleSubreddit.js b/inc/teddit_api/handleSubreddit.js index a0245d1..261cf7e 100644 --- a/inc/teddit_api/handleSubreddit.js +++ b/inc/teddit_api/handleSubreddit.js @@ -50,13 +50,17 @@ module.exports = function() { if(is_self_link) link.url = link.permalink - - let thumb_mime = '' - let ext = thumbnail.split('.').pop() - if(ext === 'png') - thumb_mime = 'image/png' - else - thumb_mime = 'image/jpeg' + + let enclosure = '' + if(thumbnail != '') { + let mime = '' + let ext = thumbnail.split('.').pop() + if(ext === 'png') + mime = 'image/png' + else + mime = 'image/jpeg' + enclosure = `` + } let append_desc_html = `
[link] [comments]` @@ -68,7 +72,7 @@ module.exports = function() { ${link.domain} ${link.id} ${thumbnail} - + ${enclosure} ${link.permalink} ${link.url}