From e994e0451a8d4cc01003448397b1ffeddb52c7fd Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Mon, 7 Dec 2020 02:20:08 -0500 Subject: [PATCH] fix incorrect vhost serialization --- irc/import.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/irc/import.go b/irc/import.go index 033c714a..c70ec738 100644 --- a/irc/import.go +++ b/irc/import.go @@ -113,7 +113,16 @@ func doImportDBGeneric(config *Config, dbImport databaseImport, credsType Creden tx.Set(fmt.Sprintf(keyAccountCredentials, cfUsername), string(marshaledCredentials), nil) tx.Set(fmt.Sprintf(keyAccountRegTime, cfUsername), strconv.FormatInt(userInfo.RegisteredAt, 10), nil) if userInfo.Vhost != "" { - tx.Set(fmt.Sprintf(keyAccountVHost, cfUsername), userInfo.Vhost, nil) + vhinfo := VHostInfo{ + Enabled: true, + ApprovedVHost: userInfo.Vhost, + } + vhBytes, err := json.Marshal(vhinfo) + if err == nil { + tx.Set(fmt.Sprintf(keyAccountVHost, cfUsername), string(vhBytes), nil) + } else { + log.Printf("couldn't serialize vhost for %s: %v\n", username, err) + } } if len(userInfo.AdditionalNicks) != 0 { tx.Set(fmt.Sprintf(keyAccountAdditionalNicks, cfUsername), marshalReservedNicks(userInfo.AdditionalNicks), nil)