Fix link header parsing to handle unquoted rel
types (#15973)
This commit is contained in:
parent
d33b223674
commit
02b532fb1d
|
@ -1830,7 +1830,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
// we only support the URL in angle brackets and `rel`, other attributes are ignored
|
||||
// user can still parse it themselves via the Headers property
|
||||
const string pattern = "<(?<url>.*?)>;\\s*rel=(\"?)(?<rel>.*?)\\1[^\\w -.]?";
|
||||
const string pattern = "<(?<url>.*?)>;\\s*rel=(?<quoted>\")?(?<rel>(?(quoted).*?|[^,;]*))(?(quoted)\")";
|
||||
IEnumerable<string> links;
|
||||
if (response.Headers.TryGetValues("Link", out links))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue