fix: 在filter之前检查空数据 (#2392)

* enhance: 对路由空内容报错

* fix: 在filter之前检查空数据
This commit is contained in:
Chenyang Shi
2019-06-13 11:34:39 +08:00
committed by DIYgod
parent 8aed54cd37
commit 7c5fcaccc5

View File

@@ -3,6 +3,10 @@ const he = require('he');
module.exports = async (ctx, next) => {
await next();
if (ctx.state.data && ctx.state.data.item.length === 0) {
throw Error('该路由目前获取内容为空请检查源站情况或前往https://github.com/DIYgod/RSSHub/issues反馈该问题');
}
// decode HTML entities
if (ctx.state.data) {
ctx.state.data.title && (ctx.state.data.title = he.decode(ctx.state.data.title + ''));