Skip to content

fix: [Port Forwarding] newly added port range rule incorrectly appears in single port tab #756

Description

@PeterJhongLinksys

Description

When adding a new rule from the Port Range tab, the rule appears in the Single Port tab instead of the Port Range tab.

Root Cause

The tab filtering logic in lib/page/port_forwarding/views/usp_port_forwarding_detail_view.dart uses the isSinglePort getter from lib/page/_shared/models/port_forwarding_rule_ui_model.dart:

bool get isSinglePort =>
    externalPortEndRange == 0 || externalPortEndRange == externalPort;

If externalPortEndRange equals externalPort (e.g., when the user enters the same value for start and end), the rule is classified as single port. Additionally, if the dialog result does not correctly set externalPortEndRange, the default value of 0 would also cause the rule to be classified as single port.

Expected Behavior

Rules created from the Port Range tab should always appear in the Port Range tab. The classification logic should account for the creation context, or the dialog should enforce that end port is strictly greater than start port with a clear error message.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions