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:
parent
a7a3d533e7
commit
170e3113e1
1 changed files with 4 additions and 1 deletions
|
@ -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"+
|
||||||
|
|
Loading…
Reference in a new issue