From 9837763bed8c13346b5901728344b62f3e49d5dd Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 23 Apr 2018 23:45:40 -0700 Subject: [PATCH] simplify filepath --- connect.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connect.go b/connect.go index a1d33d20..294cf2bb 100644 --- a/connect.go +++ b/connect.go @@ -10,6 +10,7 @@ import ( "os" "os/signal" "path" + "path/filepath" "strconv" "strings" "sync" @@ -85,6 +86,7 @@ func NewConnection(config *AppConfig) (*Connection, error) { config.File = "stdin" } if len(config.File) > 0 { + config.File = filepath.Clean(config.File) if config.File == "stdin" { f, err := ioutil.TempFile(".", "croc-stdin-") if err != nil { @@ -121,7 +123,7 @@ func NewConnection(config *AppConfig) (*Connection, error) { // we set the value IsDir to true c.File.IsDir = true } - c.File.Name = path.Base(info.Name()) + c.File.Name = path.Base(config.File) c.File.Path = path.Dir(config.File) c.IsSender = true } else {