From 54dc4d4499f9e9698ad1a9c459f60643a2b096a4 Mon Sep 17 00:00:00 2001 From: Lucas Roesler Date: Mon, 3 Sep 2018 16:01:59 +0200 Subject: [PATCH] Ensure that we name the copy dest correctly **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 --- Gopkg.lock | 2 +- builder/build.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index f7a1b3398..6c3610bf9 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -95,6 +95,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "13931e3dc144611ad27c9cc8e720fdf547dcd2ca4538e7446cbf390235d32ca0" + inputs-digest = "d87f11b11c23cf6aee9a8368e041cca35177f41668c25f68c5d74a75522c5fdf" solver-name = "gps-cdcl" solver-version = 1 diff --git a/builder/build.go b/builder/build.go index 0b93a65cd..8d1eec84d 100644 --- a/builder/build.go +++ b/builder/build.go @@ -7,6 +7,7 @@ import ( "fmt" "io/ioutil" "os" + "path/filepath" "strings" "github.com/openfaas/faas-cli/schema" @@ -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()), + ) } } @@ -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()), + ) } }