Skip to content

Commit 2982369

Browse files
committed
fix: 修复短链路由正则表达式,限制匹配4-8位字母数字
1 parent 2240387 commit 2982369

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

web/src/router/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ const routes = [
1313
{ path: '/dashboard', component: DashboardPage },
1414
{ path: '/stats/:shortCode', component: StatsPage },
1515
{ path: '/about', component: AboutPage, meta: { public: true } },
16-
// 短链跳转路由(匹配所有未定义的路径)
17-
{ path: '/:shortCode', component: RedirectPage, meta: { public: true, hideNav: true } },
16+
// 短链跳转路由(匹配 4-8 位字母数字组合)
17+
{
18+
path: '/:shortCode(\\w{4,8})',
19+
component: RedirectPage,
20+
meta: { public: true, hideNav: true }
21+
},
1822
]
1923

2024
const router = createRouter({

0 commit comments

Comments
 (0)