mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix link header parsing to handle unquoted rel types (#15973)
This commit is contained in:
+1
-1
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user