Use filepath instead of path to create SQLite3 database file (#28374) (#28378)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Fix #28300

(cherry picked from commit 5eaf91e919)
This commit is contained in:
Giteabot 2023-12-07 01:22:18 +08:00 committed by Earl Warren
parent 3a788340f0
commit f484ad6a29
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -9,7 +9,6 @@ import (
"net"
"net/url"
"os"
"path"
"path/filepath"
"strings"
"time"
@ -119,7 +118,7 @@ func DBConnStr() (string, error) {
if !EnableSQLite3 {
return "", errors.New("this Gitea binary was not built with SQLite3 support")
}
if err := os.MkdirAll(path.Dir(Database.Path), os.ModePerm); err != nil {
if err := os.MkdirAll(filepath.Dir(Database.Path), os.ModePerm); err != nil {
return "", fmt.Errorf("Failed to create directories: %w", err)
}
journalMode := ""