A CLI tool helps you to manage the development of kubesphere extensions
10
stars
19
forks
source link
unmarshal the extension metadata failed: error converting YAML to JSON: yaml: control characters are not allowed #84
Closed
stoneshi-yunify closed 4 months ago
一个非常诡异的事件。with ksbuilder 0.3.9 & 0.3.8
一个开发者提交了一个extension包,需要上架到kubesphere.com.cn 的应用市场。
我解压安装包,看到extension.yaml 引用了static 目录中的图片,就把static 中的图片都上传到s3了。然后更改了extension.yaml 中的screenshots和icon 字段,如下:
之后删除了static中的所有文件。然后执行
成功打包出一个新的 arksec-redstone-2.15.7.tgz, 然后将这个包上传到cloud。
上传时,cloud 会调用 ksbuilder 的 ValidateExtension 方法, 这个方法报错:
the original package: old-arksec-redstone-2.15.7.tgz
the new package (with picture links): arksec-redstone-2.15.7.tgz
我本地使用如下代码测试了下,错误一样:
输出:
打了断点,进入validateextension 方法,发现获得的 extension.yaml 的 buffer 里确实有很多 NUL 字符,所以报错了。old package 里解析到的buffer 里没有 NUL 字符串。
这表明new package 中的extension.yaml 有问题,不能解析。
但奇怪的是,如果把new package 在本地解压,直接用yaml.unmarshal 解析其中的extension.yaml ,并不会出错。这说明错误发生在 validateextension 的过程中。
我怀疑触发了这个bug:![Screenshot 2024-03-02 at 18 33 52](https://github.com/kubesphere/ksbuilder/assets/70880165/144b6783-b6d1-435b-970e-a054890ed178)
如果把 这里的代码 换成这样就没问题了:
麻烦你也在本地试一下,是否也有这个问题。