Skip to content

Apostrophe in file name breaks registry.js #9159

@Sainan

Description

@Sainan

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io. (Can repro on StackBlitz; CodeSandbox filters apostrophes.)
  • I have read the console error message carefully (if applicable).

Description

For example, creating a file called "Beginner's Guide.md" causes it to be written to registry.js verbatim:

image

So, we obviously have a syntax error there.

image

Reproducible demo

No response

Steps to reproduce

  1. Create a file with an apostrophe in it's name, such as "Beginner's Guide.md"
  2. Run npm start

Expected behavior

The apostrophe would be escaped.

Actual behavior

The apostrophe is written verbatim.

Your environment

  • Docusaurus version used: Whichever the latest one published to NPM is as of 2023-07-20

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executiondifficulty: starterIssues that are starter difficulty level, e.g. minimal tweaking with a clear test plan.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions