dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.91k stars 476 forks source link

Change URL detection regex to exclude trailing content #6572

Closed JamesNK closed 2 weeks ago

JamesNK commented 3 weeks ago

Description

URL detection regex was including trailing content in the URL after semi-colon. In some connection strings this would pick up extra values, e.g. content after the URL would be included in Endpoint=http://myaccount.example.com/;key=abc.

The new URL is based on GitHub's URL detection for source code. It excludes content after ; from the URL. This is the same behavior as VS. Technically ; can be part of a URL, but more commonly it is used as a delimiter for connection strings and collections of URLs.

There isn't a perfect answer here, but the new regex match seems the better alternative. We should be conservative when assuming what content should be in the URL rather than aggressively including too much.

Checklist