From a789fb80eb7808d967dbf14e90dadd77210ebbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Fri, 14 Dec 2018 11:13:31 +0800 Subject: [PATCH] Hotfix: jike img (#1283) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 翻车的图片是 https://cdn.ruguoapp.com/FmPwBqyD-hbbTUTxSC_UsmmDD-jR?imageMogr2/auto-orient/heic-exif/1/format/jpeg/thumbnail/1329336@ 这种格式,`?imageMogr2` 前并没有 `.后缀名` 这样的跟着,直接 `split('?imageMogr2/')` 后图片无法访问。试了下也找不到原始的文件是怎样的,因此目前的处理方式是判断到 `?imageMogr2` 前有 `.后缀名` 才进行 `split` 操作,没有的话直接使用不带 `thumbnail` 的部分 - Closes #1282 --- routes/jike/common.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/routes/jike/common.js b/routes/jike/common.js index ace2768ea..eee0c01f1 100644 --- a/routes/jike/common.js +++ b/routes/jike/common.js @@ -109,9 +109,8 @@ module.exports = { default: break; } - description += `
`; + const imgUrl = pic.picUrl.match(/\.[a-z0-9]+?\?imageMogr2/) ? pic.picUrl.split('?imageMogr2/')[0] : pic.picUrl.replace(/thumbnail\/.+/, ''); + description += `
`; } }); }