Commit e411d0c
fix: strip UTF-8 BOM from funcignore and fix negation pattern handling (Azure#7311)
* fix: strip UTF-8 BOM from funcignore and fix negation pattern handling
The go-gitignore library does not handle UTF-8 BOM (byte order mark)
that some Windows editors (e.g. Notepad) prepend to files. When a
.funcignore file has a BOM, the invisible prefix bytes become part of
the first pattern, causing it to never match. This broke the
node_modules exclusion detection in resolveFunctionAppRemoteBuild,
leading to incorrect remoteBuild validation results.
Changes:
- Strip UTF-8 BOM from .funcignore content before parsing in both
resolveFunctionAppRemoteBuild (validation) and createDeployableZip
(packaging) for consistent behavior
- Switch createDeployableZip from gitignore.NewFromFile to manual
read + gitignore.New for consistency with validation code path
- Fix negation pattern handling in createDeployableZip: check
match.Ignore() instead of just match != nil, so negation patterns
(e.g. !node_modules/important) correctly include files
- Add comprehensive BOM-handling tests and stripUTF8BOM unit tests
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: clean up temp zip file on ignore file read error
Close and remove the temporary zip file when reading the ignore file
fails with a non-NotExist error, preventing file handle leaks and
orphaned temp files (especially on Windows).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: retrigger CI (Windows extension test flake)
The previous Windows BuildCLI failure was a known file-locking flake in
Test_CLI_Extension_ForceInstall — unrelated to this PR's changes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: merge CustomerScenarios into JavaScriptMatrix test
Addresses review feedback from @weikanglim. The CustomerScenarios test
was duplicating 8 of 9 cases from JavaScriptMatrix. Merged Case 9
(true + no funcignore) into JavaScriptMatrix and added customer case
comments for traceability. Removed the duplicate test function.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent f2a971e commit e411d0c
3 files changed
Lines changed: 295 additions & 16 deletions
File tree
- cli/azd/pkg/project
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
36 | 46 | | |
37 | | - | |
38 | | - | |
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
| |||
68 | 76 | | |
69 | 77 | | |
70 | 78 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
74 | 84 | | |
75 | 85 | | |
76 | 86 | | |
| |||
112 | 122 | | |
113 | 123 | | |
114 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
| |||
0 commit comments