Skip to content

Commit 6b1e5f7

Browse files
authored
Prevent panic on empty HOST for mysql (#11850) (#11856)
Backport #11850 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 56660c3 commit 6b1e5f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/setting/database.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func DBConnStr() (string, error) {
105105
switch Database.Type {
106106
case "mysql":
107107
connType := "tcp"
108-
if Database.Host[0] == '/' { // looks like a unix socket
108+
if len(Database.Host) > 0 && Database.Host[0] == '/' { // looks like a unix socket
109109
connType = "unix"
110110
}
111111
tls := Database.SSLMode

0 commit comments

Comments
 (0)