Skip to content

Commit

Permalink
fix(template): correct check of old sarif template files (aquasecurit…
Browse files Browse the repository at this point in the history
  • Loading branch information
afdesk authored Apr 16, 2022
1 parent a0047a7 commit 407f3b6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/report/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package report

import (
"io"
"path/filepath"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -53,7 +52,7 @@ func Write(report types.Report, option Option) error {
writer = cyclonedx.NewWriter(option.Output, option.AppVersion)
case "template":
// We keep `sarif.tpl` template working for backward compatibility for a while.
if strings.HasPrefix(option.OutputTemplate, "@") && filepath.Base(option.OutputTemplate) == "sarif.tpl" {
if strings.HasPrefix(option.OutputTemplate, "@") && strings.HasSuffix(option.OutputTemplate, "sarif.tpl") {
log.Logger.Warn("Using `--template sarif.tpl` is deprecated. Please migrate to `--format sarif`. See https://github.com/aquasecurity/trivy/discussions/1571")
writer = SarifWriter{Output: option.Output, Version: option.AppVersion}
break
Expand Down

0 comments on commit 407f3b6

Please sign in to comment.