diff --git a/back/loaders/express.ts b/back/loaders/express.ts index b04daeb9..b31ce871 100644 --- a/back/loaders/express.ts +++ b/back/loaders/express.ts @@ -45,11 +45,10 @@ export default ({ app }: { app: Application }) => { if (req.path.startsWith('/open/')) { const openService = Container.get(OpenService); const doc = await openService.findTokenByValue(headerToken); - if (doc && doc.tokens.length > 0) { + if (doc && doc.tokens && doc.tokens.length > 0) { const currentToken = doc.tokens.find((x) => x.value === headerToken); - const key = - req.path.match(/\/open\/([a-z]+)\/*/) && - req.path.match(/\/open\/([a-z]+)\/*/)[1]; + const keyMatch = req.path.match(/\/open\/([a-z]+)\/*/); + const key = keyMatch && keyMatch[1]; if ( doc.scopes.includes(key as any) && currentToken && diff --git a/shell/task.sh b/shell/task.sh index f0b8967b..c86302f0 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -169,7 +169,7 @@ run_designated() { local env_param="$2" local num_param=$(echo "$3" | perl -pe "s|.*$2 (.*)|\1|") if [[ ! $env_param ]] || [[ ! $num_param ]]; then - echo -e "\n 缺少单独运行的参数 task xxx.js single Test 1" + echo -e "\n 缺少单独运行的参数 task xxx.js desi Test 1 3" exit 1 fi