Skip to content

🐛 Bug [flutter_link_previewer]: URL with underscore _ is truncated #883

@khoidv-dipro

Description

@khoidv-dipro

Description
flutter_link_previewer fails to detect full URLs when the path or query contains underscore (_).
Example: YouTube Live URLs are truncated during parsing.
This causes incorrect preview data and broken link previews in production apps.

Steps to reproduce

  1. Use LinkPreview with the following text:
    https://www.youtube.com/live/wFTD_Tm9als?si=w99NseYI2KIDz7_Z
  2. Observe the detected link in onLinkPreviewDataFetched

Actual behavior
The detected URL is truncated:
https://www.youtube.com/live/wFTD_

Expected behavior
The full URL should be detected:
https://www.youtube.com/live/wFTD_Tm9als?si=w99NseYI2KIDz7_Z

Root cause
The internal regex used to detect links does not allow underscore (_) in the final path/query segment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions