Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Check pathnames for illegal characters (e.g. outputPath for build files)

未关闭
#19,533 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
angular, typescript
领域
build-system, cli

调研方向

首先,在 Windows 沙盒中使用 issue 中描述的 angular.json 配置,复现将 outputPath 设置为 .../distng build 命令。跟踪构建如何处理该路径,并验证无效的路径名会在创建文件或目录之前产生警告或错误。

由索引模型根据 Issue 内容生成。

描述

area: @angular-devkit/build-angular feature feature: insufficient votes

🐞 Bug report

Command (mark with an x)
  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc
Description

The Angular CLI should warn the user if a specified path is invalid for the current system.

I accidently set ".../dist" (three dots) as outputPath in angular.json. Correct is "../dist" (two dots). Running ng build created a huge mess. In the app root a folder has been created with ... as name (ending a folder name in Windows with a dot is illegal). Inside of this three dot folder all of my project files were listed (including node_modules folder). There was also a folder named ..., which again contained my whole project files. This recursively went to whatever level (I clicked throuhg the folder approximately 30 levels down, there was still a ... folder). Deleting the first ... folder lastet more than 15 minutes, then telling me the files which should be deleted aren't there anymore. Also my project files in the root directory were deleted in this process (luckily most of it in Git). That was the strangest thing, it felt like the content inside of ... mirrored my root project somehow (like in https://superuser.com/questions/528502/cant-remove-three-dots-folder-on-my-hdd). I also tried reverting my files using Git which did not work at all. I managed to delete the whole repository locally with rm -rf 'folder' using the GitBash. After cloning the project again, my IDE (Webstorm) listed the ... folder once again, which luckily could be deleted this time. The project looks fine right now, and with the correct outputPath the app builds correctly.

It would be nice if the CLI checks pathnames for illegal characters. I did not try any other illegal characters inside of the path name.

🔬 Minimal Reproduction

Caution: Try in a sandbox environment with unimported files only to prevent loss of data!

  1. Change the "outputPath" in angular.json to ".../dist" (three dots)
  2. Run ng build

🌍 Your Environment




Angular CLI: 11.0.1
Node: 14.15.0
OS: win32 x64

Angular: 11.0.0
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.1
@angular-devkit/build-angular   0.1100.1
@angular-devkit/core            11.0.1
@angular-devkit/schematics      11.0.1
@angular/cdk                    11.0.1
@angular/cli                    11.0.1
@angular/material               11.0.1
@schematics/angular             11.0.1
@schematics/update              0.1100.1
rxjs                            6.6.3
typescript                      4.0.5

Anything else relevant?

ng build gone wrong

主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
16 小时 35 分钟
30 天内合并 PR
176

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angular-cli 的其他 Issue

查看 angular/angular-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。