Skip to content

Ancestor directory names containing a leading hash not supported #333

@haoqunjiang

Description

@haoqunjiang
  • Operating System: macOS High Sierra 10.13.6
  • Node Version: v10.9.0
  • NPM Version: 6.4.0
  • webpack version: 4.17.1
  • webpack-dev-middleware Version: 3.1.3
  • This is a feature request
  • This is a bug

For Bugs; How can we reproduce the behavior?

There are several bug reports in vue-cli repository related to this bug:

To reproduce it, run the following commands:

mkdir "#leadinghash"
cd "#leadinghash"
npx @vue/cli create app --default
cd app
npm run serve -- --open

Expected Behavior

A hello world page.

Actual Behavior

A blank page with following error message logged in terminal:

URIError: Failed to decode param '/%3C%=%20BASE_URL%20%%3Efavicon.ico'

Root Cause

It is actually a bug of url-join(used in middleware.js & util.js):
jfromaniello/url-join#10

require('url-join').('/some/path/with/a/leading/#hash', 'index.html')
// returns '/some/path/with/a/leading#hash/index.html', the `/` before `#` is missing

But I think it is better to solve this issue here because:

  1. Maintainers of url-join does not seem to have a strong willingness to fix this long-standing issue;
  2. Since url-join is only used to join filesystem paths in webpack-dev-middleware, path.posix,join could be a sufficient replacement.

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