Skip to content

Commit

Permalink
perf: import 丢弃非法字符
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jan 23, 2024
1 parent 6d61926 commit 5d7dabe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ const router = createRouter({
component: () => import('@/views/ImportPage.vue'),
},
{
// https://github.com/gkd-kit/inspect/files/12448138/file.zip
path: `/import/:github_zip_asset_id`,
redirect(to) {
// https://github.com/gkd-kit/inspect/files/12448138/file.zip
const url = `https://github.com/gkd-kit/inspect/files/${to.params.github_zip_asset_id}/file.zip`;
const github_zip_asset_id = String(to.params.github_zip_asset_id).match(
/^\d+/,
)?.[0]; // 丢弃非法字符
if (!github_zip_asset_id) {
return { path: '/404' };
}
const url = `https://github.com/gkd-kit/inspect/files/${github_zip_asset_id}/file.zip`;
return {
name: `import`,
query: {
Expand Down

0 comments on commit 5d7dabe

Please sign in to comment.