File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -3826,15 +3826,15 @@ func validateGitCommitHistoryContext(cmd *cobra.Command) bool {
38263826 return true
38273827}
38283828
3829- // hasGitRepository checks if the source directory contains a Git repository or is a Git URL
3829+ // hasGitRepository checks if the source directory contains a Git repository (skipping validation for git URLs or zip files)
38303830func hasGitRepository (source string ) bool {
38313831 if source == "" {
38323832 return false
38333833 }
38343834
38353835 sourceTrimmed := strings .TrimSpace (source )
38363836
3837- if util .IsGitURL (sourceTrimmed ) {
3837+ if util .IsGitURL (sourceTrimmed ) || filepath . Ext ( sourceTrimmed ) == constants . ZipExtension {
38383838 return true
38393839 }
38403840
Original file line number Diff line number Diff line change @@ -4843,6 +4843,26 @@ func TestGetGitCommitHistoryValue(t *testing.T) {
48434843 expectedValue : "false" ,
48444844 expectWarnings : "" ,
48454845 },
4846+ {
4847+ name : "Flag true with zip file - returns true" ,
4848+ flagValue : "true" ,
4849+ scanTypes : "scs" ,
4850+ scsEngines : "secret-detection" ,
4851+ source : "/path/to/source.zip" ,
4852+ ffEnabled : true ,
4853+ expectedValue : "true" ,
4854+ expectWarnings : "" ,
4855+ },
4856+ {
4857+ name : "Flag false with zip file - returns false" ,
4858+ flagValue : "false" ,
4859+ scanTypes : "scs" ,
4860+ scsEngines : "secret-detection" ,
4861+ source : "/path/to/source.zip" ,
4862+ ffEnabled : true ,
4863+ expectedValue : "false" ,
4864+ expectWarnings : "" ,
4865+ },
48464866 }
48474867
48484868 for _ , tt := range tests {
You can’t perform that action at this time.
0 commit comments