lang, gapi: Work around a copy bug in the deploy

It seems when we had a files/ dir that we added to our deploy, it would
get copied into /files/files/whatever instead of /files/whatever where
it should be. Hopefully this works around the issue forever.
This commit is contained in:
James Shubin
2019-07-22 06:40:47 -04:00
parent 5d59cfd2c9
commit f2f9c043bf
2 changed files with 11 additions and 0 deletions

View File

@@ -340,6 +340,15 @@ func (obj *GAPI) Cli(cliInfo *gapi.CliInfo) (*gapi.Deploy, error) {
}
if strings.HasSuffix(src, "/") { // it's a dir
// FIXME: I think fixing CopyDirToFs might be better...
if dst != "/" { // XXX: hack, don't nest the copy badly!
out, err := util.RemovePathSuffix(dst)
if err != nil {
// possible programming error
return nil, errwrap.Wrapf(err, "malformed dst dir path: `%s`", dst)
}
dst = out
}
// TODO: add more tests to this (it is actually CopyFs)
if err := gapi.CopyDirToFs(fs, src, dst); err != nil {
return nil, errwrap.Wrapf(err, "can't copy dir from `%s` to `%s`", src, dst)