fix(zhihu): a tag without href (#10995)

This commit is contained in:
cubercsl
2022-10-04 11:51:34 +00:00
committed by GitHub
parent 79e0237f74
commit b2167dc38b
+1 -1
View File
@@ -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));