Skip to content

Python: Fix URL parsing to handle trailing punctuation in deployment progress detection#2296

Merged
eavanvalkenburg merged 2 commits intoalert-autofix-29from
copilot/sub-pr-2274
Nov 18, 2025
Merged

Python: Fix URL parsing to handle trailing punctuation in deployment progress detection#2296
eavanvalkenburg merged 2 commits intoalert-autofix-29from
copilot/sub-pr-2274

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

The URL extraction logic in the Azure Container Apps deployment manager was failing to correctly identify azurecontainerapps.io URLs when they appeared with trailing punctuation (e.g., in sentences ending with periods or followed by commas).

Changes

  • Improved regex pattern: Changed from r'https://[^\s]+' to r'https://[^\s<>"]+' to exclude angle brackets and quotes that would never be part of a URL
  • Added punctuation stripping: Strip common trailing punctuation (.,;:!?\'")}]) before hostname extraction via urlparse()

Example

# Before: These would fail to match
"Deployed to https://myapp.azurecontainerapps.io."  # hostname: "myapp.azurecontainerapps.io."
"Visit https://myapp.azurecontainerapps.io, thanks" # hostname: "myapp.azurecontainerapps.io,"

# After: Correctly extracts clean hostnames
url_clean = url.rstrip('.,;:!?\'")}]')  
host = urlparse(url_clean).hostname  # "myapp.azurecontainerapps.io"

This ensures deployment progress messages trigger correctly regardless of surrounding punctuation context.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incomplete URL substring sanitization in code scanning Fix URL parsing to handle trailing punctuation in deployment progress detection Nov 18, 2025
@github-actions github-actions bot changed the title Fix URL parsing to handle trailing punctuation in deployment progress detection Python: Fix URL parsing to handle trailing punctuation in deployment progress detection Nov 18, 2025
@eavanvalkenburg eavanvalkenburg marked this pull request as ready for review November 18, 2025 10:35
@eavanvalkenburg eavanvalkenburg merged commit 17b5f4c into alert-autofix-29 Nov 18, 2025
3 checks passed
eavanvalkenburg added a commit that referenced this pull request Nov 18, 2025
…progress detection (#2296)

* Initial plan

* Fix URL parsing to handle trailing punctuation correctly

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Nov 18, 2025
* Potential fix for code scanning alert no. 29: Incomplete URL substring sanitization

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Python: Fix URL parsing to handle trailing punctuation in deployment progress detection (#2296)

* Initial plan

* Fix URL parsing to handle trailing punctuation correctly

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* updated lock

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
Co-authored-by: Victor Dibia <chuvidi2003@gmail.com>
@crickman crickman deleted the copilot/sub-pr-2274 branch November 19, 2025 16:39
arisng pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
* Potential fix for code scanning alert no. 29: Incomplete URL substring sanitization

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Python: Fix URL parsing to handle trailing punctuation in deployment progress detection (microsoft#2296)

* Initial plan

* Fix URL parsing to handle trailing punctuation correctly

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* updated lock

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
Co-authored-by: Victor Dibia <chuvidi2003@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants