Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
Quote curl URL (#1097)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres Martinez Gotor authored Nov 19, 2019
1 parent e701fe1 commit f3191b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/utils/kubelessutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func getProvisionContainer(function, checksum, fileName, handler, contentType, r
originFile = decodedFile
} else if strings.Contains(contentType, "url") {
fromURLFile := "/tmp/func.fromurl"
prepareCommand = appendToCommand(prepareCommand, fmt.Sprintf("curl %s -L --silent --output %s", function, fromURLFile))
prepareCommand = appendToCommand(prepareCommand, fmt.Sprintf("curl '%s' -L --silent --output %s", function, fromURLFile))
originFile = fromURLFile
} else if strings.Contains(contentType, "text") || contentType == "" {
// Assumming that function is plain text
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/kubelessutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ func TestGetProvisionContainer(t *testing.T) {
if err != nil {
t.Errorf("Unexpected error: %s", err)
}
if !strings.HasPrefix(c.Args[0], "curl https://raw.githubusercontent.com/test/test/test/test.py -L --silent --output /tmp/func.fromurl") {
if !strings.HasPrefix(c.Args[0], "curl 'https://raw.githubusercontent.com/test/test/test/test.py' -L --silent --output /tmp/func.fromurl") {
t.Errorf("Unexpected command: %s", c.Args[0])
}

Expand All @@ -930,7 +930,7 @@ func TestGetProvisionContainer(t *testing.T) {
if err != nil {
t.Errorf("Unexpected error: %s", err)
}
if !strings.HasPrefix(c.Args[0], "curl https://raw.githubusercontent.com/test/test/test/test.py -L --silent --output /tmp/func.fromurl") {
if !strings.HasPrefix(c.Args[0], "curl 'https://raw.githubusercontent.com/test/test/test/test.py' -L --silent --output /tmp/func.fromurl") {
t.Errorf("Unexpected command: %s", c.Args[0])
}
}

0 comments on commit f3191b2

Please sign in to comment.