From 48854eda8044fc6f4abc2b3baa08a9e312af38ca Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Sat, 7 Jul 2018 12:05:58 +0200 Subject: [PATCH] Add trailing slash if missing on path options --- server/server.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/server.go b/server/server.go index 33f1d7b..ed35b03 100644 --- a/server/server.go +++ b/server/server.go @@ -54,6 +54,7 @@ import ( assetfs "github.com/elazarl/go-bindata-assetfs" autocert "golang.org/x/crypto/acme/autocert" + "path/filepath" ) const SERVER_INFO = "transfer.sh" @@ -109,12 +110,20 @@ func ProfileListener(s string) OptionFn { func WebPath(s string) OptionFn { return func(srvr *Server) { + if s[len(s)-1:len(s)] != "/" { + s = s + string(filepath.Separator) + } + srvr.webPath = s } } func TempPath(s string) OptionFn { return func(srvr *Server) { + if s[len(s)-1:len(s)] != "/" { + s = s + string(filepath.Separator) + } + srvr.tempPath = s } }