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

extract method does not work with '#' since v6.5 #225

Closed
albert-gonzalez opened this issue Nov 27, 2019 · 4 comments
Closed

extract method does not work with '#' since v6.5 #225

albert-gonzalez opened this issue Nov 27, 2019 · 4 comments

Comments

@albert-gonzalez
Copy link

Hi!

I am trying to update the library from v6.2 and I have found an issue since v6.5. The extract method returns an empty string when I pass a value with a #. For example

  • extract('https://wwww.domain.com#hello?param=1'); // returns ''
  • extract('#hello?param=1'); // returns '';

I think the problem is in the function "removeHash", introduced in the v6.5. This function removes all the string that is after the #. I wrote this simple fiddle with an example: https://jsfiddle.net/5Ljnwc07/

Do you think it's a bug? Or I am doing something wrong?

Thank you!

@albert-gonzalez albert-gonzalez changed the title extract method does not work since v6.5 extract method does not work with '#' since v6.5 Nov 27, 2019
@serhii12
Copy link

Any updates on this?

@samuelpetroline
Copy link

It seems that this is the intended behaviour:

t.is(queryString.extract('https://foo.bar#top?foo=bar'), '');

@baile320
Copy link

baile320 commented Feb 21, 2020

Additional potential support that this is intended behavior: see this stackoverflow answer (which references to RFC 3986). Percent encoding can escape the #, if that is something you have control over.

@sindresorhus
Copy link
Owner

Closing as this is working as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants