fix(get): prevents templating invalid utf8 values
This commit is contained in:
parent
f5fb9ec96b
commit
9914f51140
1 changed files with 2 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
@ -117,7 +118,7 @@ func get(cmd *cobra.Command, args []string) error {
|
||||||
return fmt.Errorf("cannot get '%s': %v", args[0], err)
|
return fmt.Errorf("cannot get '%s': %v", args[0], err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !noTemplate {
|
if !noTemplate && utf8.Valid(v) {
|
||||||
var substitutions []string
|
var substitutions []string
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
substitutions = args[1:]
|
substitutions = args[1:]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue