Skip to content

Query parameter values are truncated at a second equals sign #2810

Description

@xu91102

Bug Report

Current behavior

Query parameter values are truncated at the second equals sign. On develop f34374b7423340e5ddec81c8ff565c26cc056fb5, parseQuery('?id=a=b=c&other=ok') returns {id: 'a', other: 'ok'} instead of preserving a=b=c.

The same parser is used by both hash and HTML5 history, so route queries exposed to plugins are affected. Values containing a literal equals sign, including padded encoded data, lose information.

Reproduction

From the source checkout:

import { parseQuery } from './src/core/router/util.js';
console.log(parseQuery('?id=a=b=c&other=ok'));
// { id: 'a', other: 'ok' }

Expected behavior

Only the first equals sign separates the parameter name from its value. Remaining equals signs should stay in the value. Existing decoding, plus-to-space conversion, empty values and valueless parameters should retain their behavior.

Environment

Docsify 5.0.0 develop source, Node.js on macOS. Reproduced directly and with a failing Jest regression in the existing router utility suite.

Activity

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

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