修复类型检查

This commit is contained in:
hanhh 2021-09-29 23:15:09 +08:00
parent 5655591215
commit 2068ef7053
2 changed files with 4 additions and 5 deletions

View File

@ -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 &&

View File

@ -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