From 8ca1256552fe9219e9419856c00ebb7e2c965ad7 Mon Sep 17 00:00:00 2001 From: Moqizhongyuan <2356373295@qq.com> Date: Wed, 4 Sep 2024 22:39:04 +0800 Subject: [PATCH] deal special code in address --- src/core/hooks/AutoLink.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/hooks/AutoLink.js b/src/core/hooks/AutoLink.js index e6931779..22b5bb7b 100644 --- a/src/core/hooks/AutoLink.js +++ b/src/core/hooks/AutoLink.js @@ -173,7 +173,10 @@ export default class AutoLink extends SyntaxBase { return match; } // TODO: Url Validator - return `${prefix}${this.renderLink(`${$protocol}${address}`)}${suffix}`; + return `${prefix}${this.renderLink( + // 将特殊字符进行转义 + `${$protocol}${address.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')}`, + )}${suffix}`; } // this should never happen return match;