Title: Invoke-RestMethod: Link relation type is not captured by Regex when value is not quoted · Issue #15972 · PowerShell/PowerShell · GitHub
Open Graph Title: Invoke-RestMethod: Link relation type is not captured by Regex when value is not quoted · Issue #15972 · PowerShell/PowerShell
X Title: Invoke-RestMethod: Link relation type is not captured by Regex when value is not quoted · Issue #15972 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/15972
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invoke-RestMethod: Link relation type is not captured by Regex when value is not quoted","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\nUsing Invoke-RestMethod with `-FollowRelLink` works when the server returns a Link header with relation type `rel=\"next\"`, but not when the relation type is `rel=next` without quotes, although [the Web Linking RFC](https://datatracker.ietf.org/doc/html/rfc5988#page-6) allows it. Quotes are only required under specific circumstances, never for [IANA relation types](https://www.iana.org/assignments/link-relations/link-relations.xhtml).\r\n\r\n```\r\n relation-types = relation-type\r\n | \u003c\"> relation-type *( 1*SP relation-type ) \u003c\">\r\n relation-type = reg-rel-type | ext-rel-type\r\n reg-rel-type = LOALPHA *( LOALPHA | DIGIT | \".\" | \"-\" )\r\n ext-rel-type = URI\r\n```\r\n\r\n> Note that extension relation types are REQUIRED to be absolute URIs in Link headers, and MUST be quoted if they contain a semicolon (\";\") or comma (\",\") (as these characters are used as delimiters in the header itself).\r\n\r\nThe Regex pattern can be found here. https://github.com/PowerShell/PowerShell/blob/e70ad6ce251d2e1d4ef79e31756cededde7ccc91/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs#L1833\r\n\r\n### Expected behavior\r\n\r\n```console\r\nPS> Invoke-RestMethod \"https://api.guildwars2.com/v2/quaggans?page=0&page_size=10\" -FollowRelLink\r\n\r\nid url\r\n-- ---\r\n404 https://static.staticwars.com/quaggans/404.jpg\r\naloha https://static.staticwars.com/quaggans/aloha.jpg\r\nattack https://static.staticwars.com/quaggans/attack.jpg\r\nbear https://static.staticwars.com/quaggans/bear.jpg\r\nbowl https://static.staticwars.com/quaggans/bowl.jpg\r\nbox https://static.staticwars.com/quaggans/box.jpg\r\nbreakfast https://static.staticwars.com/quaggans/breakfast.jpg\r\nbubble https://static.staticwars.com/quaggans/bubble.jpg\r\ncake https://static.staticwars.com/quaggans/cake.jpg\r\ncheer https://static.staticwars.com/quaggans/cheer.jpg\r\ncoffee https://static.staticwars.com/quaggans/coffee.jpg\r\nconstruction https://static.staticwars.com/quaggans/construction.jpg\r\ncow https://static.staticwars.com/quaggans/cow.jpg\r\ncry https://static.staticwars.com/quaggans/cry.jpg\r\nelf https://static.staticwars.com/quaggans/elf.jpg\r\nghost https://static.staticwars.com/quaggans/ghost.jpg\r\ngirl https://static.staticwars.com/quaggans/girl.jpg\r\nhat https://static.staticwars.com/quaggans/hat.jpg\r\nhelmut https://static.staticwars.com/quaggans/helmut.jpg\r\nhoodie-down https://static.staticwars.com/quaggans/hoodie-down.jpg\r\nhoodie-up https://static.staticwars.com/quaggans/hoodie-up.jpg\r\nkillerwhale https://static.staticwars.com/quaggans/killerwhale.jpg\r\nknight https://static.staticwars.com/quaggans/knight.jpg\r\nlollipop https://static.staticwars.com/quaggans/lollipop.jpg\r\nlost https://static.staticwars.com/quaggans/lost.jpg\r\nmoving https://static.staticwars.com/quaggans/moving.jpg\r\nparty https://static.staticwars.com/quaggans/party.jpg\r\npresent https://static.staticwars.com/quaggans/present.jpg\r\nquaggan https://static.staticwars.com/quaggans/quaggan.jpg\r\nrain https://static.staticwars.com/quaggans/rain.jpg\r\nscifi https://static.staticwars.com/quaggans/scifi.jpg\r\nseahawks https://static.staticwars.com/quaggans/seahawks.jpg\r\nsleep https://static.staticwars.com/quaggans/sleep.jpg\r\nsummer https://static.staticwars.com/quaggans/summer.jpg\r\nvacation https://static.staticwars.com/quaggans/vacation.jpg\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\n```console\r\nPS> Invoke-RestMethod \"https://api.guildwars2.com/v2/quaggans?page=0&page_size=10\" -FollowRelLink\r\n\r\nid url\r\n-- ---\r\n404 https://static.staticwars.com/quaggans/404.jpg\r\naloha https://static.staticwars.com/quaggans/aloha.jpg\r\nattack https://static.staticwars.com/quaggans/attack.jpg\r\nbear https://static.staticwars.com/quaggans/bear.jpg\r\nbowl https://static.staticwars.com/quaggans/bowl.jpg\r\nbox https://static.staticwars.com/quaggans/box.jpg\r\nbreakfast https://static.staticwars.com/quaggans/breakfast.jpg\r\nbubble https://static.staticwars.com/quaggans/bubble.jpg\r\ncake https://static.staticwars.com/quaggans/cake.jpg\r\ncheer https://static.staticwars.com/quaggans/cheer.jpg\r\n```\r\n\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```powershell\r\nName Value\r\n---- -----\r\nPSVersion 7.1.4\r\nPSEdition Core\r\nGitCommitId 7.1.4\r\nOS Microsoft Windows 10.0.19043\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/sliekens","@type":"Person","name":"sliekens"},"datePublished":"2021-08-22T14:45:40Z","url":"https://github.com/PowerShell/PowerShell/issues/15972"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2b115e9e-7b43-d117-fc93-8199fbfc476b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA76:11138E:1DB45C:299C22:6AFD51D4 |
| html-safe-nonce | 2a17008814256714046dddfcbb0958be721cdf7f0e46349476d985abf3d41eaf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTc2OjExMTM4RToxREI0NUM6Mjk5QzIyOjZBRkQ1MUQ0IiwidmlzaXRvcl9pZCI6IjkwMTU1NDIyNzc3NTMwOTg3MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 99eb6a2179dcd6a2819deb8aef9cb3a6fa640cb8589834965e60fc7aed276b3a |
| hovercard-subject-tag | issue:976394064 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/15972/issue_layout |
| twitter:image | https://opengraph.githubassets.com/05f9a07925317d495ef95003132bb62f2be63773e8a5fd3c946cd8a5a47c43b8/PowerShell/PowerShell/issues/15972 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/05f9a07925317d495ef95003132bb62f2be63773e8a5fd3c946cd8a5a47c43b8/PowerShell/PowerShell/issues/15972 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sliekens |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width