Validate derived candidate tags before checks
This commit is contained in:
@@ -100,7 +100,7 @@ func (endpoint Endpoint) Recheck(ctx context.Context, repositoryDir string) erro
|
||||
// Query reads exact main and tag refs. A command failure is unreadable,
|
||||
// never evidence that a ref is absent.
|
||||
func (endpoint Endpoint) Query(ctx context.Context, repositoryDir, tag string) (Snapshot, error) {
|
||||
if err := checkTagRef(ctx, repositoryDir, tag); err != nil {
|
||||
if err := CheckTagRef(ctx, repositoryDir, tag); err != nil {
|
||||
return Snapshot{}, err
|
||||
}
|
||||
mainRef := "refs/heads/main"
|
||||
@@ -301,7 +301,8 @@ func finalizeRef(ref RemoteRef) RemoteRef {
|
||||
return ref
|
||||
}
|
||||
|
||||
func checkTagRef(ctx context.Context, repositoryDir, tag string) error {
|
||||
// CheckTagRef validates a complete tag name using Git ref rules.
|
||||
func CheckTagRef(ctx context.Context, repositoryDir, tag string) error {
|
||||
if tag == "" {
|
||||
return fmt.Errorf("invalid Git tag name %q", tag)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user