Skip to content

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

@lpww

Description

@lpww

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')(['*']);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions