Skip to content

Commit

Permalink
Lower case command value before comparision
Browse files Browse the repository at this point in the history
The lowercasing of the command value was undone
to allow to print an error message with the original casing.

moby/buildkit#2218 (comment)
for more context.
  • Loading branch information
ingvagabund committed Jul 4, 2024
1 parent ebc2119 commit 2591a37
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/helpers/newapp/docker/dockerfile/dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"strings"

"github.com/fsouza/go-dockerclient"
docker "github.com/fsouza/go-dockerclient"
"github.com/moby/buildkit/frontend/dockerfile/command"
"github.com/moby/buildkit/frontend/dockerfile/parser"
)
Expand All @@ -23,7 +23,10 @@ func FindAll(node *parser.Node, cmd string) []int {
}
var indices []int
for i, child := range node.Children {
if child != nil && child.Value == cmd {
// Originally, the values were lower cased.
// It changed after https://github.com/moby/buildkit/pull/2218#discussion_r662726727
// due to showing the errors with the original casing.
if child != nil && strings.ToLower(child.Value) == cmd {
indices = append(indices, i)
}
}
Expand Down Expand Up @@ -184,7 +187,7 @@ func evalVars(n *parser.Node, from, to int, ports []string, shlex *ShellLex) []s
}
evaledPorts := make([]string, 0)
for i := from; i <= to; i++ {
switch n.Children[i].Value {
switch strings.ToLower(n.Children[i].Value) {
case command.Expose:
args := nextValues(n.Children[i])
for _, arg := range args {
Expand Down

0 comments on commit 2591a37

Please sign in to comment.