Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

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

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
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
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
Copy link
Contributor

@markekraus markekraus left a comment

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

Copy link
Contributor

@markekraus markekraus left a comment

Choose a reason for hiding this comment

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

@SteveL-MSFT
Copy link
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