Skip to content

Commit

Permalink
make trailing slash still work
Browse files Browse the repository at this point in the history
  • Loading branch information
SwampDragons committed Jul 12, 2018
1 parent 36df317 commit 00eba7e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion communicator/winrm/communicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,15 @@ func runCommand(shell *winrm.Shell, cmd *winrm.Command, rc *packer.RemoteCmd) {
}

// Upload implementation of communicator.Communicator interface
func (c *Communicator) Upload(path string, input io.Reader, _ *os.FileInfo) error {
func (c *Communicator) Upload(path string, input io.Reader, fi *os.FileInfo) error {
wcp, err := c.newCopyClient()
if err != nil {
return fmt.Errorf("Was unable to create winrm client: %s", err)
}
if strings.HasSuffix(path, `\`) {
// path is a directory
path += filepath.Base((*fi).Name())
}
log.Printf("Uploading file to '%s'", path)
return wcp.Write(path, input)
}
Expand Down

0 comments on commit 00eba7e

Please sign in to comment.