Repository navigation
Remove utf-8 BOM when loading chart files and helmignore - #7972
Conversation
Removes the BOM prefix if present, in read files before processing the data. Affects the following pkg: - pkg/chart/loader: directory and archive loader - internal/ignore: when loading .helmignore file Signed-off-by: Thomas FREYSS <[email protected]>
|
Asking out of ignorance: Is there any case where a bare BOM might appear in the middle of a file, and legitimately so? For example, if a configmap has a field that contains a complete file, and that file for some reason needs the BOM. I looked around a little, and I can't find information on this. My guess is that a BOM in the middle of a YAML doc is against the YAML spec. But I am not sure. |
mattfarina
left a comment
There was a problem hiding this comment.
Can we get a test to verify the BOM is in the test chart? This is to make sure a change from someone does not accidentally remove it. We want to make sure the invisible characters are not accidentally dropped.
|
@technosophos
|
Signed-off-by: Thomas FREYSS <[email protected]>
I added a test to check the presence of BOM in the test data beforehand. Is this what you were looking for ? |
|
Based on @IppX 's last note from the YAML spec, I think this is good as-is. @mattfarina can you weigh in on the test you asked for? I was not totally clear what you were asking for there, but I think the new test addresses your concern. |
mattfarina
left a comment
There was a problem hiding this comment.
This is great. Thanks for adding the test. This will help us to not accidentally delete the BOMs in the test files.
|
Thanks for taking the time to review this ! |
Closes #6081
Removes the BOM prefix if present, in read files before processing the data.
Affects the following pkg:
It's my first contribution and I'm no golang expert please be gentle :).
I initially tried another solution with BOMOverride to also handle UTF-16 BOM but it broke other parts that I did not understand.
Also let me know if I need to backport this to v2.x.