Skip to content

[BUG] [v0.0.7] clean_html() parses DOM and iterates all descendants in a no-op loop with unused _result before calling remove_tags() (html.rs:506-517) #53515

Description

@andrirevo

Project

cortex

Description

When clean_html removes images under certain settings, it parses the DOM and walks all descendants in a loop that performs no meaningful mutation, allocates an unused string, and then relies on remove_tags for the real work. This is wasted CPU and complexity on hot paths (scraping), and suggests an incomplete refactor. While not always user-visible, it is a maintainability and performance smell.

Error Message

Debug Logs

System Information

Windows 11

Screenshots

https://github.com/springoliver/bounty_challenge_report_image/blob/main/49115.png

Steps to Reproduce

  1. Open the affected cortex command or screen.
  2. Execute the exact input pattern named in this issue title and narrative.
  3. Compare actual output against the expected contract documented by the reporter.

Expected Behavior

The reporter expects cortex to match documented CLI/TUI contracts for this flow—correct output, honest flags/help, and no silent contradictions—consistent with the problem statement at the top of this rewrite.

Actual Behavior

When clean_html removes images under certain settings, it parses the DOM and walks all descendants in a loop that performs no meaningful mutation, allocates an unused string, and then relies on remove_tags for the real work. This is wasted CPU and complexity on hot paths (scraping), and suggests an incomplete refactor. While not always user-visible, it is a maintainability and performance smell.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis doesn't seem right

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions