Skip to content

withQuery do not encode ';' #240

@zhangsn

Description

@zhangsn

Environment

Not related

Reproduction

var ufo = require("ufo")
console.log(ufo.withQuery("/foo?page=a", { token: "sec;ret" }));
//should output /foo?page=a&secret=sec%3Bret

Describe the bug

ufo use encodeURI not encodeURIComponent to encode query value,therefore ';' is not encoded

see:

return encodeURI("" + text).replace(ENC_PIPE_RE, "|");

Is there any special reason to use encodeURI?

Additional context

No response

Logs

No response

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