lib/api: String comparisons

This commit is contained in:
Jakob Borg 2022-07-28 18:49:44 +02:00
parent 0c8b22c696
commit 6baa93e13f
3 changed files with 4 additions and 4 deletions

View File

@ -572,7 +572,7 @@ func loadRelays(file string) []*relay {
var relays []*relay var relays []*relay
for _, line := range strings.Split(string(content), "\n") { for _, line := range strings.Split(string(content), "\n") {
if len(line) == 0 { if line == "" {
continue continue
} }

View File

@ -1017,7 +1017,7 @@ func (s *service) postSystemReset(w http.ResponseWriter, r *http.Request) {
} }
} }
if len(folder) == 0 { if folder == "" {
// Reset all folders. // Reset all folders.
for folder := range s.cfg.Folders() { for folder := range s.cfg.Folders() {
if err := s.model.ResetFolder(folder); err != nil { if err := s.model.ResetFolder(folder); err != nil {

View File

@ -81,7 +81,7 @@ func (s *staticsServer) serveAsset(w http.ResponseWriter, r *http.Request) {
file = file[1:] file = file[1:]
} }
if len(file) == 0 { if file == "" {
file = "index.html" file = "index.html"
} }
@ -136,7 +136,7 @@ func (s *staticsServer) serveFromAssetDir(file, theme string, w http.ResponseWri
return false return false
} }
mtype := assets.MimeTypeForFile(file) mtype := assets.MimeTypeForFile(file)
if len(mtype) != 0 { if mtype == "" {
w.Header().Set("Content-Type", mtype) w.Header().Set("Content-Type", mtype)
} }
http.ServeFile(w, r, p) http.ServeFile(w, r, p)