goharbor / goharbor/harbor-cli

[bug]:The ValidateURL function fails to validate URLs that use single-label hostnames

Open
#879 1 comment 0 reactions 0 assignees View on GitHub
bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.