mirror of
https://github.com/stablyai/orca.git
synced 2026-11-03 02:27:43 +00:00
fix: accept enterprise managed GitHub owner logins (#20450)
Unify owner validation across project pickers and repository overrides. Preserve EMU usernames in API and auth-status branch-prefix resolution, with regression coverage. Co-authored-by: Neil <neil@stably.ai>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// Why: owner/repo overrides become authenticated REST paths, so the slug gate
|
||||
// must keep rejecting path-shaped input while accepting every real login shape —
|
||||
// including Enterprise Managed User logins, which end in `_<shortcode>`.
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { isValidGitHubApiRepository } from './github-api-repository-validation'
|
||||
|
||||
describe('isValidGitHubApiRepository', () => {
|
||||
it('accepts plain and Enterprise Managed User owners', () => {
|
||||
expect(isValidGitHubApiRepository({ owner: 'acme', repo: 'orca' })).toBe(true)
|
||||
expect(isValidGitHubApiRepository({ owner: 'octocat_acme', repo: 'level5' })).toBe(true)
|
||||
})
|
||||
|
||||
it('rejects leading underscore, hyphen, dot, and path-shaped owners', () => {
|
||||
expect(isValidGitHubApiRepository({ owner: '_acme', repo: 'orca' })).toBe(false)
|
||||
expect(isValidGitHubApiRepository({ owner: '-acme', repo: 'orca' })).toBe(false)
|
||||
expect(isValidGitHubApiRepository({ owner: '.acme', repo: 'orca' })).toBe(false)
|
||||
expect(isValidGitHubApiRepository({ owner: 'a/b', repo: 'orca' })).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects reserved and path-shaped repos', () => {
|
||||
expect(isValidGitHubApiRepository({ owner: 'acme', repo: '.' })).toBe(false)
|
||||
expect(isValidGitHubApiRepository({ owner: 'acme', repo: '..' })).toBe(false)
|
||||
expect(isValidGitHubApiRepository({ owner: 'acme', repo: 'a/b' })).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user