diff options
| author | Paul Buetow <paul@buetow.org> | 2021-10-14 20:55:35 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-15 08:40:54 +0300 |
| commit | 698fb76b98c46c677abe13fdc93afc6c4f38c39e (patch) | |
| tree | ac6884ea24d262c36d1f3b6e12a6adf2ba7acb8b /internal | |
| parent | 06ece112c0dd20c0c211c538216fe64ebe4045c9 (diff) | |
refactor
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/server/handlers/basehandler.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/internal/server/handlers/basehandler.go b/internal/server/handlers/basehandler.go index 934f2bc..6d10d17 100644 --- a/internal/server/handlers/basehandler.go +++ b/internal/server/handlers/basehandler.go @@ -159,11 +159,16 @@ func (h *baseHandler) handleCommand(commandStr string) { cancel() }() - dlog.Server.Trace(args) - dlog.Server.Trace(args[0]) - splitted := strings.Split(args[0], ":") - commandName := splitted[0] - options, ltx, err := config.DeserializeOptions(splitted[1:]) + parts := strings.Split(args[0], ":") + commandName := parts[0] + + // Either no options or empty options provided. + if len(parts) == 1 || len(parts[1]) == 0 { + h.handleCommandCb(ctx, lcontext.LContext{}, argc, args, commandName) + return + } + + options, ltx, err := config.DeserializeOptions(parts[1:]) if err != nil { h.send(h.serverMessages, dlog.Server.Error(h.user, err)) return |
