Skip to content

[bug]: Reject invalid page values in artifact, project, and registry list commands #778

@PrasunaEnumarthy

Description

@PrasunaEnumarthy

Description

Some paginated list commands validate --page-size but do not validate --page.

Steps to Reproduce

  1. Run command:
    • harbor artifact list --page 0
    • harbor project list --page -1
    • harbor registry list --page 0
  2. Observe that the command does not fail early with a clear validation error.

Expected Behavior

Commands that support pagination should reject invalid page values before making API calls.

Actual Behavior

Some commands validate --page-size but not --page, so invalid page values are accepted and passed to the API.

Environment

  • OS: any
  • Tool version: current main branch
  • Other relevant details: none

Additional Context

Reference implementation:

  • cmd/harbor/root/project/logs.go

Target files:

  • cmd/harbor/root/artifact/list.go
  • cmd/harbor/root/project/list.go
  • cmd/harbor/root/registry/list.go

This is a follow-up to the validation added for --page-size in #631.

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