fix(publish): read the helm chart name from the top-level key only - #1231
Conversation
There was a problem hiding this comment.
Dropping the per-line trim() is the right fix: nested name: entries under dependencies:/maintainers: are always indented, so strip_prefix("name:") on the raw line now only matches a top-level key. str::lines() strips the trailing \r, so the CRLF test exercises what it claims to, and the value-side trim() still handles trailing spaces and quotes. Both new tests fail before the change.
Nit: the scan still misses YAML that helm itself accepts, notably name : my-chart (space before the colon) and a quoted key "name": my-chart, and it would pick up a name: in a second document after ---. serde_norway is already a dependency in the same cli feature set this module lives in (publishers/mod.rs pulls colored), so deserialising into a small struct with a name field would remove the whole class of edge cases rather than adding another string rule each time one turns up. Not worth blocking on: the current form covers every Chart.yaml helm's own helm create emits.
Closes #1230
read_chart_nametrimmed each line before matchingname:, so in a Chart.yaml listingdependencies:ormaintainers:before the chart's ownname:, the nested entry won and the chart was checked and pushed under the dependency's name. Only unindented lines count now. Tests cover the nested case (fails before the fix) and CRLF with single quotes.