mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
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:
@@ -18,7 +18,10 @@ func initializeSQLiteProvider(basePath string) error {
|
|||||||
var err error
|
var err error
|
||||||
var connectionString string
|
var connectionString string
|
||||||
if len(config.ConnectionString) == 0 {
|
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)
|
fi, err := os.Stat(dbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warn(logSender, "sqlite database file does not exists, please be sure to create and initialize"+
|
logger.Warn(logSender, "sqlite database file does not exists, please be sure to create and initialize"+
|
||||||
|
|||||||
Reference in New Issue
Block a user