log file: if the path is not absolute make it relative to config dir

Also refuse to join invalid file name such as "."

Fixes #85
This commit is contained in:
Nicola Murino
2020-03-03 00:34:06 +01:00
parent df67f4ef34
commit d0a81cabab
9 changed files with 27 additions and 5 deletions

View File

@@ -32,6 +32,9 @@ func initializeSQLiteProvider(basePath string) error {
logSender = SQLiteDataProviderName
if len(config.ConnectionString) == 0 {
dbPath := config.Name
if dbPath == "." {
return fmt.Errorf("Invalid database path: %#v", dbPath)
}
if !filepath.IsAbs(dbPath) {
dbPath = filepath.Join(basePath, dbPath)
}