Skip to content

HtmlDecode hrefs in Verify-Links.ps1 #10616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged

Conversation

hallipr
Copy link
Member

@hallipr hallipr commented May 12, 2025

fixes #10601

In html, attribute values are encoded and should be decoded before use. If not decoded using [HttpUtility]::HtmlDecode(), the url is incorrect and the server should not be expected to process it correctly.

In powershell, the markdown

[example](https://dev.azure.com/azure-sdk/public/_build?view=branches&definitionId=7050)

is converted to the html

<a href="https://dev.azure.com/azure-sdk/public/_build?view=branches&amp;definitionId=7050">Example</a>

which is regex parsed to

https://dev.azure.com/azure-sdk/public/_build?view=branches&amp;definitionId=7050

and needs to be HtmlDecoded to

https://dev.azure.com/azure-sdk/public/_build?view=branches&definitionId=7050

@Copilot Copilot AI review requested due to automatic review settings May 12, 2025 22:47
@hallipr hallipr requested a review from a team as a code owner May 12, 2025 22:47
Copilot

This comment was marked as outdated.

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@hallipr hallipr force-pushed the users/pahallis/parse-html-hrefs branch from ef28a3e to b82b377 Compare May 12, 2025 23:13
@hallipr hallipr requested a review from Copilot May 12, 2025 23:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR decodes HTML-encoded URLs in anchor hrefs to ensure that link resolution works correctly by using [System.Web.HttpUtility]::HtmlDecode.

  • Renames the variable holding regex matches from $hrefs to $matches
  • Adds a step to HTML-decode the href values before resolving them
  • Updates verbose logging to reflect the changes

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

azure-sdk added a commit to Azure/azure-sdk-for-js that referenced this pull request May 14, 2025
@hallipr hallipr merged commit 880bd91 into main May 14, 2025
14 checks passed
@hallipr hallipr deleted the users/pahallis/parse-html-hrefs branch May 14, 2025 17:37
JoshLove-msft pushed a commit to JoshLove-msft/azure-sdk-tools that referenced this pull request May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify-Links.ps1 doesn't handle html special characters
3 participants