Skip to content

Commit

Permalink
feat: 统一扫描器离线相关配置处理逻辑 -- 兼容历史配置 TencentBlueKing#39
Browse files Browse the repository at this point in the history
  • Loading branch information
myqonnt committed May 30, 2023
1 parent 822902a commit 41b2ed3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trivy/pkg/scan_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type TrivyExecutor struct{}
func (e TrivyExecutor) Execute(config *object.ToolConfig, file *os.File) (*object.ToolOutput, error) {
offline, err := config.GetBoolArg(constant.ConfigOffline)
if err != nil {
return nil, err
offline = len(config.GetStringArg(constant.ArgDbDownloadUrl)) > 0
}
if offline {
if err := downloadAllDB(config); err != nil {
Expand All @@ -46,7 +46,7 @@ func downloadAllDB(config *object.ToolConfig) error {

// download java db
javaDbUrl := config.GetStringArg(constant.ArgJavaDbDownloadUrl)
if len(javaDbUrl) == 0 {
if len(javaDbUrl) > 0 {
javaDbDir := filepath.Join(constant.DbCacheDir, constant.JavaDbDir)
if err := util.ExtractTarUrl(javaDbUrl, javaDbDir, 0770, downloader); err != nil {
return err
Expand Down

0 comments on commit 41b2ed3

Please sign in to comment.