{"action":"created","issue":{"url":"https://api.github.com/repos/jgm/CommonMark/issues/270","labels_url":"https://api.github.com/repos/jgm/CommonMark/issues/270/labels{/name}","comments_url":"https://api.github.com/repos/jgm/CommonMark/issues/270/comments","events_url":"https://api.github.com/repos/jgm/CommonMark/issues/270/events","html_url":"https://github.com/jgm/CommonMark/issues/270","id":53494638,"number":270,"title":"Buggy url encoder in commonmark.js","user":{"login":"puzrin","id":319465,"avatar_url":"https://avatars.githubusercontent.com/u/319465?v=3","gravatar_id":"","url":"https://api.github.com/users/puzrin","html_url":"https://github.com/puzrin","followers_url":"https://api.github.com/users/puzrin/followers","following_url":"https://api.github.com/users/puzrin/following{/other_user}","gists_url":"https://api.github.com/users/puzrin/gists{/gist_id}","starred_url":"https://api.github.com/users/puzrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puzrin/subscriptions","organizations_url":"https://api.github.com/users/puzrin/orgs","repos_url":"https://api.github.com/users/puzrin/repos","events_url":"https://api.github.com/users/puzrin/events{/privacy}","received_events_url":"https://api.github.com/users/puzrin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jgm/CommonMark/labels/JS","name":"JS","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":33,"created_at":"2015-01-06T09:04:55Z","updated_at":"2015-02-22T10:29:21Z","closed_at":null,"body":"https://github.com/jgm/CommonMark/blob/master/js/lib/inlines.js#L190\r\n\r\nIt can throw exception:\r\n\r\n1. on invalid url format\r\n2. on broken unicode sequence\r\n3. on some valid urls\r\n\r\nAlso it can produce non-standard urls for international domain names.\r\n\r\nI plan migrate to https://github.com/defunctzombie/node-url instead of home-made magical kludges. That can also require to fix some tests content (didn't checked yet).\r\n\r\nNormalization is not mandatory, but it's more simple to use well-tested solution instead of describing all edge cases and writing correct encoder.\r\n\r\nFor reference:\r\n\r\n- https://en.wikipedia.org/wiki/URL_normalization"},"comment":{"url":"https://api.github.com/repos/jgm/CommonMark/issues/comments/75429014","html_url":"https://github.com/jgm/CommonMark/issues/270#issuecomment-75429014","issue_url":"https://api.github.com/repos/jgm/CommonMark/issues/270","id":75429014,"user":{"login":"puzrin","id":319465,"avatar_url":"https://avatars.githubusercontent.com/u/319465?v=3","gravatar_id":"","url":"https://api.github.com/users/puzrin","html_url":"https://github.com/puzrin","followers_url":"https://api.github.com/users/puzrin/followers","following_url":"https://api.github.com/users/puzrin/following{/other_user}","gists_url":"https://api.github.com/users/puzrin/gists{/gist_id}","starred_url":"https://api.github.com/users/puzrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puzrin/subscriptions","organizations_url":"https://api.github.com/users/puzrin/orgs","repos_url":"https://api.github.com/users/puzrin/repos","events_url":"https://api.github.com/users/puzrin/events{/privacy}","received_events_url":"https://api.github.com/users/puzrin/received_events","type":"User","site_admin":false},"created_at":"2015-02-22T10:29:21Z","updated_at":"2015-02-22T10:29:21Z","body":"https://github.com/markdown-it/markdown-it/tree/normalize\r\n \r\nPlay with that branch (`make test`). I've tried to rewrite normalizer with using `url` library. Got many broken tests from spec:\r\n\r\n1. It always add missed `/` after domain name (`http://example.com?abc` -> `http://example.com/?abc`)\r\n2. It replaces `\\` with `/` in query `http://example.com?abc` https://github.com/joyent/node/commit/f7ede33f09187cd9b1874982e813380cd292ef17\r\n\r\nWorkaround in tests needed, or we have to do completely custom url parser for markdown :("}}