From df67f4ef34acae73fb9e54c5368957548d4bdb2e Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Mon, 2 Mar 2020 22:56:14 +0100 Subject: [PATCH] clean config dir Fixes #80 --- cmd/install_windows.go | 3 ++- cmd/portable.go | 2 +- cmd/serve.go | 4 +++- cmd/start_windows.go | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/install_windows.go b/cmd/install_windows.go index cb463057..b2c89be2 100644 --- a/cmd/install_windows.go +++ b/cmd/install_windows.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "path/filepath" "github.com/drakkan/sftpgo/service" "github.com/spf13/cobra" @@ -18,7 +19,7 @@ sftpgo service install Please take a look at the usage below to customize the startup options`, Run: func(cmd *cobra.Command, args []string) { s := service.Service{ - ConfigDir: configDir, + ConfigDir: filepath.Clean(configDir), ConfigFile: configFile, LogFilePath: logFilePath, LogMaxSize: logMaxSize, diff --git a/cmd/portable.go b/cmd/portable.go index 80869b31..1f8a1355 100644 --- a/cmd/portable.go +++ b/cmd/portable.go @@ -77,7 +77,7 @@ Please take a look at the usage below to customize the serving parameters`, portableGCSAutoCredentials = 0 } service := service.Service{ - ConfigDir: defaultConfigDir, + ConfigDir: filepath.Clean(defaultConfigDir), ConfigFile: defaultConfigName, LogFilePath: portableLogFile, LogMaxSize: defaultLogMaxSize, diff --git a/cmd/serve.go b/cmd/serve.go index 897b5cfa..85112ce0 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -1,6 +1,8 @@ package cmd import ( + "path/filepath" + "github.com/drakkan/sftpgo/service" "github.com/spf13/cobra" ) @@ -16,7 +18,7 @@ sftpgo serve Please take a look at the usage below to customize the startup options`, Run: func(cmd *cobra.Command, args []string) { service := service.Service{ - ConfigDir: configDir, + ConfigDir: filepath.Clean(configDir), ConfigFile: configFile, LogFilePath: logFilePath, LogMaxSize: logMaxSize, diff --git a/cmd/start_windows.go b/cmd/start_windows.go index 34e19a6e..d1ce8a8e 100644 --- a/cmd/start_windows.go +++ b/cmd/start_windows.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "path/filepath" "github.com/drakkan/sftpgo/service" "github.com/spf13/cobra" @@ -13,7 +14,7 @@ var ( Short: "Start SFTPGo Windows Service", Run: func(cmd *cobra.Command, args []string) { s := service.Service{ - ConfigDir: configDir, + ConfigDir: filepath.Clean(configDir), ConfigFile: configFile, LogFilePath: logFilePath, LogMaxSize: logMaxSize,