Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add support for parsing Link Header with variable whitespace#7322

Merged
iSazonov merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
SteveL-MSFT:link-header-whitespaceSteveL-MSFT/PowerShell:link-header-whitespaceCopy head branch name to clipboard
Jul 24, 2018
Merged

Add support for parsing Link Header with variable whitespace#7322
iSazonov merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
SteveL-MSFT:link-header-whitespaceSteveL-MSFT/PowerShell:link-header-whitespaceCopy head branch name to clipboard

Conversation

@SteveL-MSFT

@SteveL-MSFT SteveL-MSFT commented Jul 20, 2018

Copy link
Copy Markdown
Member

add support for variable whitespace in link header

PR Summary

Thanks to the @cruscio's analysis, it appears that the Link Header allows for any amount of whitespace or even no whitespace. The currently explicitly expect a single whitespace after the semicolon in the Link Header before the Rel property.

Fix is to change the regex to allow for variable or no whitespace and associated tests to handle these two cases. Changed GetLink helper to support passing in whitespace to use.

Fix #5667

PR Checklist

add support for variable whitespace in link header
fix codefactor issues
// we only support the URL in angle brackets and `rel`, other attributes are ignored
// user can still parse it themselves via the Headers property
string pattern = "<(?<url>.*?)>;\\srel=\"(?<rel>.*?)\"";
string pattern = "<(?<url>.*?)>;\\s*rel=\"(?<rel>.*?)\"";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please do not introduce any overlapping terms

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Resolved, I misread the Regex

markekraus
markekraus previously approved these changes Jul 21, 2018

@markekraus markekraus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@markekraus markekraus dismissed their stale review July 21, 2018 12:23

documentation needed

@markekraus markekraus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

@markekraus added documentation!

@iSazonov iSazonov merged commit f5a7d79 into PowerShell:master Jul 24, 2018
@SteveL-MSFT SteveL-MSFT deleted the link-header-whitespace branch July 24, 2018 16:28
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.

Link Header pagination fails when there's no space between ';' and 'rel'

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.