Skip to content

Commit bcb65be

Browse files
stantheman0128claudepan93412
authored
fix: validate domain search query includes TLD (#220)
* fix: validate domain search query includes TLD When searching without a TLD (e.g., `zeabur domain search antnest`), the API returns `{"available": false, "tld": ""}` which is misleading. Users may think the domain is taken when it was just an invalid query. Add validation to require a dot in the domain name and show a helpful error message guiding users to provide a full domain with TLD. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: use ContainsRune for single character --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Yi-Jyun Pan <pan93412@gmail.com>
1 parent 7b135b7 commit bcb65be

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

internal/cmd/domain/search/search.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package search
33
import (
44
"context"
55
"fmt"
6+
"strings"
67

78
"github.com/briandowns/spinner"
89
"github.com/spf13/cobra"
@@ -43,6 +44,10 @@ func runSearch(f *cmdutil.Factory, opts *Options) error {
4344
opts.query = query
4445
}
4546

47+
if !strings.ContainsRune(opts.query, '.') {
48+
return fmt.Errorf("please provide a full domain name with TLD (e.g., example.com, example.io)")
49+
}
50+
4651
s := spinner.New(cmdutil.SpinnerCharSet, cmdutil.SpinnerInterval,
4752
spinner.WithColor(cmdutil.SpinnerColor),
4853
spinner.WithSuffix(" Checking availability..."),

0 commit comments

Comments
 (0)