Skip to content

url parsing fails if front slash before fragment is missing and no path specified #131

Closed

Description

@holger-waschke

we send azure alerts to alertmanager. alertmanager parse the url

https://github.com/prometheus/alertmanager/blob/d7ad5e12f8f823ec64e4e84e91d926b6a8e60f71/cli/alert_add.go#L127C25-L127C28

https://portal.azure.com#@930d042f-8145....

This is covered in the RFC and should be supported
https://www.rfc-editor.org/rfc/rfc3986#appendix-B

However we get an error while parsing the url

{"code":601,"message":"0.generatorURL in body must be of type uri: \"https://portal.azure.com#@930d042f-....""}

Can you please check why it fails and fix accordingly?

Activity

  1. fredbi commented on Mar 14, 2025

    @fredbi
    Member

    That is correct: https://portal.azure.com#@930d042 (fragment following an empty path) is a valid URI.
    We rely on go stdlib url.ParseRequestURI() to validate. And that one is confused by this construct.

    https://portal.azure.com/#@930d042f-8145 -> with a slash following the hostname is less prone to errors.²

  2. added a commit that references this issue on Mar 17, 2025
  3. added a commit that references this issue on Apr 18, 2026
  4. added a commit that references this issue on Apr 29, 2026
  5. added a commit that references this issue on May 22, 2026
  6. added a commit that references this issue on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址