Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linkValidation escapes hash after a query string #1237

Closed
websirnik opened this issue Oct 20, 2016 · 1 comment
Closed

linkValidation escapes hash after a query string #1237

websirnik opened this issue Oct 20, 2016 · 1 comment
Labels

Comments

@websirnik
Copy link
Contributor

Description

If I set linkValidation: true option, the hash in this valid URL http://example.com?query=value#anchor will be escaped, though it should not. This is not happening with these URLs though: http://example.com?query#anchor & http://example.com?query1&query2#anchor. So it feels like the = is causing the problem.

Steps to reproduce

  1. Initialise editor with linkValidation: true option
  2. Select a word
  3. Add this URL as hyperlink: http://example.com?query=value#anchor

Expected behavior: Hyperlink should point to http://example.com?query=value#anchor

Actual behavior: Hyperlink points to http://example.com?query=value%23anchor

Link to an example:
Add this ULR as hyperlink http://example.com?query=value%23anchor here
http://codepen.io/websirnik/pen/NREQEZ

Versions

  • medium-editor: 5.22.1
  • browser: Chorme 53
  • OS: Mac OS
@j0k3r j0k3r added the bug label Oct 20, 2016
kevindew added a commit to kevindew/medium-editor that referenced this issue Dec 9, 2016
Fix for: yabwe#1237

Previously URIs were split at a question mark to determine path and
query components. This caused a problem when fragments were part of a
link as they were deemed to be part of the query.

This splits a URL at a ? and a # to get both components and does not
encode the fragment. It did feel a little wrong not to encode the
fragment at all as there some characters that should be encoded, however
the encodeUriComponent method is too heavy handed for a fragment.
kevindew added a commit to kevindew/medium-editor that referenced this issue Dec 9, 2016
Fix for: yabwe#1237

Previously URIs were split at a question mark to determine path and
query components. This caused a problem when fragments were part of a
link as they were deemed to be part of the query.

This splits a URL at a ? and a # to get both components and does not
encode the fragment. It did feel a little wrong not to encode the
fragment at all as there some characters that should be encoded, however
the encodeUriComponent method is too heavy handed for a fragment.
kevindew added a commit to kevindew/medium-editor that referenced this issue Dec 9, 2016
Fix for: yabwe#1237

Previously URIs were split at a question mark to determine path and
query components. This caused a problem when fragments were part of a
link as they were deemed to be part of the query.

This splits a URL at a ? and a # to get both components and does not
encode the fragment. It did feel a little wrong not to encode the
fragment at all as there some characters that should be encoded, however
the encodeUriComponent method is too heavy handed for a fragment.
@nmielnik
Copy link
Member

nmielnik commented Feb 8, 2017

Fixed via #1257

@nmielnik nmielnik closed this as completed Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants