From de4e848e6dc7a476dffbe9abd8fdd6b5c5b276f0 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Fri, 2 Nov 2018 23:57:07 +0530 Subject: [PATCH] Sanitize config paths --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 49a9bde..f13d054 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "log" "os" "path/filepath" + "strings" "time" _ "github.com/jinzhu/gorm/dialects/postgres" @@ -190,7 +191,9 @@ func main() { var c constants viper.UnmarshalKey("app", &c) - c.AssetPath = filepath.Clean(viper.GetString("app.asset_path")) + c.RootURL = strings.TrimRight(c.RootURL, "/") + c.UploadURI = filepath.Clean(c.UploadURI) + c.AssetPath = filepath.Clean(c.AssetPath) // Initialize the app context that's passed around. app := &App{