Title: parsing of schemeless URLs probably doesn't do what people want · Issue #170 · python-hyper/hyperlink · GitHub
Open Graph Title: parsing of schemeless URLs probably doesn't do what people want · Issue #170 · python-hyper/hyperlink
X Title: parsing of schemeless URLs probably doesn't do what people want · Issue #170 · python-hyper/hyperlink
Description: If people type URLs as browsers display them, and then attempt to parse that, they silently get a slightly confusing, although technically correct, result: >>> link = hyperlink.DecodedURL.from_text("example.com/some-path?some=query") >>>...
Open Graph Description: If people type URLs as browsers display them, and then attempt to parse that, they silently get a slightly confusing, although technically correct, result: >>> link = hyperlink.DecodedURL.from_text...
X Description: If people type URLs as browsers display them, and then attempt to parse that, they silently get a slightly confusing, although technically correct, result: >>> link = hyperlink.DecodedURL....
Opengraph URL: https://github.com/python-hyper/hyperlink/issues/170
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"parsing of schemeless URLs probably doesn't do what people want","articleBody":"If people type URLs as browsers display them, and then attempt to parse that, they silently get a slightly confusing, although *technically* correct, result:\r\n\r\n```python3\r\n>>> link = hyperlink.DecodedURL.from_text(\"example.com/some-path?some=query\")\r\n>>> link.scheme\r\n''\r\n>>> link.host\r\n''\r\n>>> link.path\r\n('example.com', 'some-path')\r\n>>> link.replace(scheme='https')\r\nDecodedURL(url=URL.from_text('https:example.com/some-path?some=query'))\r\n```\r\n\r\nI realize that this is the correct treatment per what putting that string into an `a href=` would do, but also, if I wanted `hyperlink` to process user input, it's not the thing that I'd expect. What's even more annoying is the *fix* required here once the URL is structured is somewhat non-intuitive: `link.replace(scheme='https', host=link.path[0], path=link.path[1:])`, rather than what a naive user might assume of `link.replace(scheme=\"https\")`.\r\n\r\nI would probably not propose `from_text` actually behave differently but I wonder if there's some way to make this type of usage idiomatic in a way that people will discover when they want this type of \"do the thing the location bar would\" behavior. Would we want something like `hyperlink.parser(with_implicit_scheme=\"https\").parse('example.com')`?","author":{"url":"https://github.com/glyph","@type":"Person","name":"glyph"},"datePublished":"2021-06-16T00:18:23Z","url":"https://github.com/python-hyper/hyperlink/issues/170"}
| 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:9f59ea5b-00fc-c7ff-f098-bbd97c59f6d0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF16:392ED4:BB3594:106AAB7:6B06E7A4 |
| html-safe-nonce | 44c5a4369539468782dd0c7c647b4933303f2bb6db84624e023c46157ec94166 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjE2OjM5MkVENDpCQjM1OTQ6MTA2QUFCNzo2QjA2RTdBNCIsInZpc2l0b3JfaWQiOiI4MjQ2NDMxMDYzNzQwOTY2ODIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ea94e57dffa419f9fc49fbb9bba5a0a7a4c87b4611af6c05789be8fa123129bf |
| hovercard-subject-tag | issue:921928558 |
| 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/python-hyper/hyperlink/170/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bd56eacba5bd5edf1f1b27e3febef48bff40203771f37ce57e7adfb97a663527/python-hyper/hyperlink/issues/170 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bd56eacba5bd5edf1f1b27e3febef48bff40203771f37ce57e7adfb97a663527/python-hyper/hyperlink/issues/170 |
| og:image:alt | If people type URLs as browsers display them, and then attempt to parse that, they silently get a slightly confusing, although technically correct, result: >>> link = hyperlink.DecodedURL.from_text... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | glyph |
| hostname | github.com |
| expected-hostname | github.com |
| None | 351ea5ca38a5758919d44ee52c70fe9003c0c2dfa20f04effd7fac0c5330c16b |
| turbo-cache-control | no-preview |
| go-import | github.com/python-hyper/hyperlink git https://github.com/python-hyper/hyperlink.git |
| octolytics-dimension-user_id | 13035907 |
| octolytics-dimension-user_login | python-hyper |
| octolytics-dimension-repository_id | 82321340 |
| octolytics-dimension-repository_nwo | python-hyper/hyperlink |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 82321340 |
| octolytics-dimension-repository_network_root_nwo | python-hyper/hyperlink |
| 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 | af8913cd0f2f77c41796be449ac66a9108825abc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width