File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,16 @@ export class SbomCollector {
4848 if ( ! options . loadFromDir && ! options . enterprise && ! options . org && ! options . repo ) {
4949 throw new Error ( "One of enterprise/org/repo or loadFromDir must be specified" ) ;
5050 }
51+ // Validate repo format if provided
52+ if ( options . repo ) {
53+ if ( typeof options . repo !== "string" || ! options . repo . includes ( "/" ) ) {
54+ throw new Error ( 'If specifying "repo", it must be in the format "org/repo".' ) ;
55+ }
56+ const [ orgPart , repoPart ] = options . repo . split ( "/" ) ;
57+ if ( ! orgPart || ! repoPart ) {
58+ throw new Error ( 'If specifying "repo", it must be in the format "org/repo" with both parts non-empty.' ) ;
59+ }
60+ }
5161 // Spread user options first then apply defaults via nullish coalescing so that
5262 // passing undefined does not erase defaults
5363 const o = { ...options } ;
You can’t perform that action at this time.
0 commit comments