Skip to content

bug: homepage in package.json breaks react-create-app if it contains a fragment identifier (#foo) #8531

Description

@michaelmcmillan

Describe the bug

This is a subtle bug which causes create-react-app to strip a character from the homepage URL and then crash. It was discovered by @cyrille-arundo, @geevb and myself.

Did you try recovering your dependencies?

Yes.

Which terms did you search for in User Guide?

Irrelevant.

Environment

Environment Info:
current version of create-react-app: 3.4.0
running from /Users/michaelmcmillan/.npm/_npx/14940/lib/node_modules/create-react-app
System:
OS: macOS 10.15.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 12.13.1 - /usr/local/bin/node
Yarn: 1.21.0 - /usr/local/bin/yarn
npm: 6.12.1 - /usr/local/bin/npm
Browsers:
Chrome: 79.0.3945.130
Firefox: 71.0
Safari: 13.0.3
npmPackages:
react: ^16.12.0 => 16.12.0
react-dom: ^16.12.0 => 16.12.0
react-scripts: 3.4.0 => 3.4.0
npmGlobalPackages:
create-react-app: Not Found

(paste the output of the command here.)

Steps to reproduce

  1. npx create-react-app my-app
  2. Add a URL with a fragment identifier to package.json's homepage: https://domain.com/page#hello"
  3. Run npm start
  4. Watch it blow up in all its glory.

Expected behavior

It should work.

Actual behavior

It blows up.

Compiled successfully!
You can now view my-app in the browser.
Local: http://localhost:3000/pag
On Your Network: http://10.10.10.86:3000/pag
Note that the development build is not optimized.
To create a production build, use yarn build.
URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico'
at decodeURIComponent (<anonymous>)
at decode_param (/Users/michaelmcmillan/reproduce/my-app/node_modules/express/lib/router/layer.js:172:12)
[...]

Reproducible demo

Check this pull request #8514

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions