diff options
author | deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> | 2022-03-06 16:33:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 16:33:45 +0800 |
commit | deec3516d53e9a9679128ade0556ccc818a67be1 (patch) | |
tree | b5c1c5d55be05a244180ece0b822e7e35dc68f42 /internal/route/install.go | |
parent | 65526f84e1d382ac01b7379f40fc56b2660d1074 (diff) |
autofix: fix check for empty string (#6804)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/route/install.go')
-rw-r--r-- | internal/route/install.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/route/install.go b/internal/route/install.go index 6e73976a..94c7dd2c 100644 --- a/internal/route/install.go +++ b/internal/route/install.go @@ -221,7 +221,7 @@ func InstallPost(c *context.Context, f form.Install) { conf.Database.SSLMode = f.SSLMode conf.Database.Path = f.DbPath - if conf.Database.Type == "sqlite3" && len(conf.Database.Path) == 0 { + if conf.Database.Type == "sqlite3" && conf.Database.Path == "" { c.FormErr("DbPath") c.RenderWithErr(c.Tr("install.err_empty_db_path"), INSTALL, &f) return @@ -280,14 +280,14 @@ func InstallPost(c *context.Context, f form.Install) { } // Check logic loophole between disable self-registration and no admin account. - if f.DisableRegistration && len(f.AdminName) == 0 { + if f.DisableRegistration && f.AdminName == "" { c.FormErr("Services", "Admin") c.RenderWithErr(c.Tr("install.no_admin_and_disable_registration"), INSTALL, f) return } // Check admin password. - if len(f.AdminName) > 0 && len(f.AdminPasswd) == 0 { + if len(f.AdminName) > 0 && f.AdminPasswd == "" { c.FormErr("Admin", "AdminPasswd") c.RenderWithErr(c.Tr("install.err_empty_admin_password"), INSTALL, f) return |