From b2167dc38b04b7b90e021944d9e9d56e0b02ffed Mon Sep 17 00:00:00 2001 From: cubercsl <2014cais01@gmail.com> Date: Tue, 4 Oct 2022 19:51:34 +0800 Subject: [PATCH] fix(zhihu): a tag without href (#10995) --- lib/v2/zhihu/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/v2/zhihu/utils.js b/lib/v2/zhihu/utils.js index 0e808a9f1..c933b5a56 100644 --- a/lib/v2/zhihu/utils.js +++ b/lib/v2/zhihu/utils.js @@ -14,7 +14,7 @@ module.exports = { $('a').each((_, elem) => { const href = $(elem).attr('href'); - if (href.startsWith('https://link.zhihu.com/?target=')) { + if (href?.startsWith('https://link.zhihu.com/?target=')) { const url = new URL(href); const target = url.searchParams.get('target'); $(elem).attr('href', decodeURIComponent(target));