mirror of
https://github.com/iflytek/skillhub.git
synced 2026-09-05 08:05:56 +00:00
fix(cli): reject ambiguous namespace paths (#606)
Signed-off-by: dongmucat <1127093059@qq.com>
This commit is contained in:
parent
b702f0f9f6
commit
bd83d2d95f
2 changed files with 5 additions and 2 deletions
|
|
@ -24,7 +24,7 @@ function parseSeparatedCoordinate(
|
|||
const namespace = skillName.slice(namespaceStart, separatorIndex)
|
||||
const slug = skillName.slice(separatorIndex + separatorLength)
|
||||
|
||||
if (!namespace || !slug) {
|
||||
if (!namespace || !slug || slug.includes('/')) {
|
||||
throw invalidCoordinate(skillName)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,10 @@ describe('parseSkillName', () => {
|
|||
'team/',
|
||||
'/my-skill',
|
||||
'--my-skill',
|
||||
'team--'
|
||||
'team--',
|
||||
'team/my-skill/extra',
|
||||
'@team/my-skill/extra',
|
||||
'team--my-skill/extra'
|
||||
])('rejects malformed coordinate %p', (skillName) => {
|
||||
expectUsageError(() => parseSkillName(skillName))
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue