Title: fix(@angular/build): prevent deleting parent directories of project root by pradhankukiran · Pull Request #32873 · angular/angular-cli · GitHub
Open Graph Title: fix(@angular/build): prevent deleting parent directories of project root by pradhankukiran · Pull Request #32873 · angular/angular-cli
X Title: fix(@angular/build): prevent deleting parent directories of project root by pradhankukiran · Pull Request #32873 · angular/angular-cli
Description: PR Checklist Please check to confirm your PR fulfills the following requirements: The commit message follows our guidelines: https://github.com/angular/angular-cli/blob/main/CONTRIBUTING.md#-commit-message-guidelines Tests for the changes have been added (for bug fixes / features) Docs have been added / updated (for bug fixes / features) PR Type What kind of change does this PR introduce? Bugfix Feature Code style update (formatting, local variables) Refactoring (no functional changes, no api changes) Build related changes CI related changes Documentation content changes Other... Please describe: What is the current behavior? The deleteOutputDir utility only checks if the output path is exactly equal to the project root. Setting the output path to a parent directory (e.g. ../ or ../../) bypasses this check, and ng build silently deletes all contents of that directory potentially wiping out source files or entire directory trees. Closes: #6485 What is the new behavior? Uses path.relative() to detect when the resolved output path is the project root OR any ancestor of it, and throws a descriptive error in both cases. Does this PR introduce a breaking change? Yes No Other information The original issue reported a user losing 10 days of work after setting outDir: "../../" which caused ng build --prod to delete their entire project directory. This fix closes the gap that has been open since 2017.
Open Graph Description: PR Checklist Please check to confirm your PR fulfills the following requirements: The commit message follows our guidelines: https://github.com/angular/angular-cli/blob/main/CONTRIBUTING.md#-com...
X Description: PR Checklist Please check to confirm your PR fulfills the following requirements: The commit message follows our guidelines: https://github.com/angular/angular-cli/blob/main/CONTRIBUTING.md#-com...
Opengraph URL: https://github.com/angular/angular-cli/pull/32873
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8f3a5f58-565e-ee64-214f-6caad5aa6936 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CA6A:6E631:13EADA8:1AF7565:6A62D1DE |
| html-safe-nonce | 7e5b89b281e4860ea3bfba02eb56151968fd621d71ce7c23ad9f74dc0750cb1a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTZBOjZFNjMxOjEzRUFEQTg6MUFGNzU2NTo2QTYyRDFERSIsInZpc2l0b3JfaWQiOiIyNDMxMDk3ODEyMjY2NzAxMjc4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a5ea5cb354d05fcecc6802f39415f9d5a041fd667b2fba94303f60c903bb20f5 |
| hovercard-subject-tag | pull_request:3456638681 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/angular/angular-cli/pull/32873/files |
| twitter:image | https://avatars.githubusercontent.com/u/127883780?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/127883780?s=400&v=4 |
| og:image:alt | PR Checklist Please check to confirm your PR fulfills the following requirements: The commit message follows our guidelines: https://github.com/angular/angular-cli/blob/main/CONTRIBUTING.md#-com... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | df33b1b61ee7b9a0af988199bfc3503c9c1acafb1f1d40e1f140ea7c84f890dd |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d41cd1bdb290013455c0ac430fa755621733f5eb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width