Skip to content

Location incorrectly handled when served from a base path containing regex-specific characters. #49179

@wartab

Description

@wartab

Which @angular/* package(s) are the source of the bug?

common, router

Is this a regression?

Yes

Description

When serving an Angular build from the file system (such as in Electron), if Angular is served from a path containing regex-syntax characters, the Angular router gets lost.

The bug was introduced in Angular 5.1.1 after this commit:
#48489

Serving Angular from the following path would fail:
C:/Users/MyUser(Test)/my-project

Please provide a link to a minimal reproduction of the bug

No reproduction link as it is environment specific.

Please provide the exception or error you saw

When this happens, the Angular application goes blank and only the error "NG04002" is shown in console with nothing else going on.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.1.6
Node: 16.18.0
Package Manager: npm 8.19.2
OS: win32 x64

Angular: 15.1.5
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, localize, material
... material-moment-adapter, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1501.6
@angular-devkit/build-angular   15.1.6
@angular-devkit/core            15.1.6
@angular-devkit/schematics      15.1.6
@angular/cli                    15.1.6
@schematics/angular             15.1.6
rxjs                            7.8.0
typescript                      4.9.5

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2The issue is important to a large percentage of users, with a workaroundarea: commonIssues related to APIs in the @angular/common packageregressionIndicates than the issue relates to something that worked in a previous versionstate: has PR

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions