goharbor / goharbor/harbor-cli
[bug]:The ValidateURL function fails to validate URLs that use single-label hostnames
- Dominant language
- Go
- Stars
- 163
- Forks
- 211
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
## Description
The ValidateURL function fails to validate URLs that use single-label hostnames (e.g., http://harbor). This prevents the CLI from being used in internal networks, Kubernetes services, or Docker Compose environments where FQDNs are not required.
## Steps to Reproduce
1. Run command: `harbor login harbor`
2. With arguments/config: `Use a single-label hostname (no dots) as the server URL.`
3. Observe error nvalid URL format: invalid host: must be a valid IP address or domain name
## Expected Behavior
The CLI should successfully parse and validate single-label hostnames according to RFC 1123, allowing connection to internal Harbor instances.
## Actual Behavior
The validator rejects any hostname that does not contain a dot and a TLD of at least 2 characters.
## Environment
- OS: macOS / Linux / Windows
- Tool version: harbor-cli (latest)
- Other relevant details: Docker/Kubernetes internal networking.
## Additional Context
Logs, screenshots, or other useful information.
Contributor guide
Assessment
This issue has not been assessed yet.