Skip to content

[bug]: Normalize webhook endpoint URL before validation in create/edit commands #799

@PrasunaEnumarthy

Description

@PrasunaEnumarthy

Description

The non-interactive webhook commands (harbor webhook create and harbor webhook edit) validate the --endpoint-url directly without normalizing it first. This is inconsistent with other Harbor CLI commands that normalize URLs using FormatUrl(...) before validation.

Steps to Reproduce

  1. Run command:
    harbor webhook create --endpoint-url example.com/webhook
  2. Or:
    harbor webhook edit --endpoint-url example.com/webhook
  3. Observe that the command may reject the URL due to a missing scheme (http:// or https://)

Expected Behavior

The CLI should normalize the input URL before validation.

Example:
example.com/webhook → https://example.com/webhook

After normalization, the URL should pass validation.

Actual Behavior

The CLI validates the raw input directly.
As a result, URLs without a scheme (such as example.com/webhook) may fail validation, even though similar inputs are accepted in other commands.

Environment

  • OS: Not specified
  • Tool version: latest
  • Other relevant details: N/A

Additional Context

Other Harbor CLI commands (e.g., registry update) normalize URLs using FormatUrl(...) before validation. The webhook commands should follow the same pattern for consistency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions