Skip to content

Commit

Permalink
Ensure that we name the copy dest correctly
Browse files Browse the repository at this point in the history
**What**
- When we iterate through function handler, we need to name the
destination with the file/folder name we are currrently inspecting
- Clean the file path before we give it to CopyFiles

**Why**
- This ensures that we copy the file _into_ the build folder and don't
try to read it ontop of the folder

Signed-off-by: Lucas Roesler <[email protected]>
  • Loading branch information
LucasRoesler authored and alexellis committed Sep 3, 2018
1 parent fe2268e commit 54dc4d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"

"github.com/openfaas/faas-cli/schema"
Expand Down Expand Up @@ -169,7 +170,10 @@ func createBuildTemplate(functionName string, handler string, language string) s
fmt.Println("Skipping \"build\" folder")
continue
default:
CopyFiles(info.Name(), functionPath)
CopyFiles(
filepath.Clean(handler+"/"+info.Name()),
filepath.Clean(functionPath+"/"+info.Name()),
)
}
}

Expand Down Expand Up @@ -204,7 +208,10 @@ func dockerBuildFolder(functionName string, handler string, language string) str
fmt.Println("Skipping \"build\" folder")
continue
default:
CopyFiles(info.Name(), tempPath)
CopyFiles(
filepath.Clean(handler+"/"+info.Name()),
filepath.Clean(tempPath+"/"+info.Name()),
)
}
}

Expand Down

0 comments on commit 54dc4d4

Please sign in to comment.