When path starts with slash, consider it absolute

When SQLite path starts with a `/`, we consider this to be an absolute path.

Eg.:

```json
{
  "data_provider":{
    "name":"/var/lib/sftpgo/sftpgo.db"
  }
}
```
This commit is contained in:
Jo Vandeginste 2019-07-31 15:08:24 +02:00 committed by drakkan
parent a7a3d533e7
commit 170e3113e1

View file

@ -18,7 +18,10 @@ func initializeSQLiteProvider(basePath string) error {
var err error
var connectionString string
if len(config.ConnectionString) == 0 {
dbPath := filepath.Join(basePath, config.Name)
dbPath := config.Name
if !filepath.IsAbs(dbPath) {
dbPath = filepath.Join(basePath, dbPath)
}
fi, err := os.Stat(dbPath)
if err != nil {
logger.Warn(logSender, "sqlite database file does not exists, please be sure to create and initialize"+