docsify icon indicating copy to clipboard operation
docsify copied to clipboard

Markdown file name with the ? suffix.

Open Koooooo-7 opened this issue 3 years ago • 1 comments

Bug Report

Steps to reproduce

Based on the official doc, made a file name deploy?.md. Add route in sidebar.

- Guide

  - [Deploy?](deploy?.md)

What is current behaviour

The path changes to /deploy without ?. and get 404 back.

What is the expected behaviour

Should find the right path to load file.

Other relevant information

  • [x] Bug does still occur when all/other plugins are disabled?

  • Your OS: macOS monterey.

  • Node.js version:

  • npm/yarn version:

  • Browser version:

  • Docsify version: latest

  • Docsify plugins:

Please create a reproducible sandbox

Edit 307qqv236

Mention the docsify version in which this bug was not present (if any)

Koooooo-7 avatar Aug 12 '22 03:08 Koooooo-7

FYI. On hash mode. We slice the ? and thought it should have the parameters, but the query is empty. https://github.com/docsifyjs/docsify/blob/3c9b3d9702bb05a5ff45a4ce4233e144cf1ebecb/src/core/router/history/hash.js#L91

    const queryIndex = path.indexOf('?');
    if (queryIndex >= 0) {
      query = path.slice(queryIndex + 1);
      path = path.slice(0, queryIndex);
    }

    return {
      path,
      file: this.getFile(path, true),
      query: parseQuery(query),
    };

Beside, the ? will be ignore in URL either, the browser think it is no params with a ?, it seems we should change to %3F instead.

Koooooo-7 avatar Aug 12 '22 03:08 Koooooo-7