Skip to content

If the path to the app contains "%20" the app doesn't work at all #8118

Closed

Description

@ludat

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Versions.

@angular/cli: 1.2.6
node: 8.7.0
os: linux x64
@angular/animations: 4.4.5
@angular/cdk: 2.0.0-beta.12
@angular/common: 4.4.5
@angular/compiler: 4.4.5
@angular/core: 4.4.5
@angular/forms: 4.4.5
@angular/http: 4.4.5
@angular/material: 2.0.0-beta.12
@angular/platform-browser: 4.4.5
@angular/platform-browser-dynamic: 4.4.5
@angular/router: 4.4.5
@angular/cli: 1.2.6
@angular/compiler-cli: 4.4.5
@angular/language-service: 4.4.5
Done in 0.70s.

Repro steps.

Run ng new, move proyecto into a directory with %20 in the name, and run ng start

The log given by the failure.

There is no error messages anywhere, the only error I get is Can't GET / when I browse any page

Desired functionality.

I can view the skeleton

Mention any other details that might be useful.

Activity

  1. changed the title [-]If the path to the app contains %20 the app doesn't work at all[/-] [+]If the path to the app contains "%20" the app doesn't work at all[/+] on Oct 22, 2017
  2. self-assigned this
    on Oct 25, 2017
  3. added
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Oct 25, 2017
  4. dinerotah commented on Jan 17, 2018

    @dinerotah
    Contributor

    this caused by webpack-dev-middleware module which consider the path as an encoded url so %20 is transformed to space.
    Here is where it happens:

    function getFilenameFromUrl(publicPath, outputPath, url) {
    var filename;

    // localPrefix is the folder our bundle should be in
    var localPrefix = urlParse(publicPath || "/", false, true);
    var urlObject = urlParse(url);

    // publicPath has the hostname that is not the same as request url's, should fail
    if(localPrefix.hostname !== null && urlObject.hostname !== null &&
    localPrefix.hostname !== urlObject.hostname) {
    return false;
    }

    // publicPath is not in url, so it should fail
    if(publicPath && localPrefix.hostname === urlObject.hostname && url.indexOf(publicPath) !== 0) {
    return false;
    }

    // strip localPrefix from the start of url
    if(urlObject.pathname.indexOf(localPrefix.pathname) === 0) {
    filename = urlObject.pathname.substr(localPrefix.pathname.length);
    }

    if(!urlObject.hostname && localPrefix.hostname &&
    url.indexOf(localPrefix.path) !== 0) {
    return false;
    }
    // and if not match, use outputPath as filename

    return querystring.unescape(filename ? pathJoin(outputPath, filename) : outputPath);
    }

    using lite-server and --watch fix the problem.

  5. ludat commented on Jan 28, 2018

    @ludat
    Author

    I imagined something like that was the cause, this issue isn't really a blocker for me since it's easy to work around it, but until I figured it out I wasted a couple of days scratching my head.

    I just want to avoid future people from encountering this issue.

  6. added and removed
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Feb 14, 2018
  7. added this to the needsTriage milestone on Jan 24, 2019
  8. modified the milestones: needsTriage, Backlog on Jan 28, 2019
  9. mgechev commented on Aug 19, 2019

    @mgechev
    Member

    Looks like a problem with old version of the CLI. Let us close the issue for now. If it's still relevant, please open a new ticket with steps to reproduce and a minimal demo. Thanks!

  10. angular-automatic-lock-bot commented on Sep 19, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  11. locked and limited conversation to collaborators on Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions