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

Asterisk (*) does not decode properly (workaround in description) #4

Open
lpww opened this issue Jan 13, 2017 · 0 comments
Open

Asterisk (*) does not decode properly (workaround in description) #4

lpww opened this issue Jan 13, 2017 · 0 comments

Comments

@lpww
Copy link

lpww commented Jan 13, 2017

Issue

There are at least 2 cases where an asterisk will not be decoded properly. I have discovered the following but there could be more examples:

  1. If the first character in a string is an asterisk. Eg. * hello.

var query = '* hello';
var encoded = juri().encodeString(query); // encoded = "*_hello"
var decoded = juri().decodeString(encoded); //decoded = "_hello"

  1. If an asterisk is next to another special character in the middle of a string. Eg. name_*.

var query = 'name_';
var encoded = juri().encodeString(query); // encoded = "name~S
"
var decoded = juri().decodeString(encoded); //decoded = "name~undefined"

I believe this is caused by the asterisk being used as part of the dictionary feature. The two cases are not properly handled.

Workaround

The workaround is to add an asterisk to the dictionary when instantiating juri:

var juri = require('juri')(['*']);

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

No branches or pull requests

1 participant