Commit 6a9f7af
committed
fix: improve version field detection regex to handle any field order
Changed the regex pattern from checking only immediately after the opening
brace to checking anywhere in the JSON. This handles valid JSON where the
'version' field appears after other fields like 'bomFormat' or 'specVersion'.
Pattern changed from: ^\s*\{\s*"version"\s*:
To: "version"\s*:\s*\d+
This prevents incorrectly adding duplicate version fields when the field
already exists but not at the beginning of the JSON object.1 parent 2fdb04d commit 6a9f7af
1 file changed
+5
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
0 commit comments