nacos V2格式导入时,可能会引起描述字段丢失问题

ttp71kqs  于 2022-11-13  发布在  Nacos
关注(0)|答案(4)|浏览(175)

V2 格式导入时,如果原始数据中,desc 字段有值,但是导入的 meta 数据中没有 desc 字段,此时保存会将 desc 字段置空。
但是查看代码,appName 字段却做了 null 的处理,并不会被覆盖,
所以此处是否是个bug

fjaof16o

fjaof16o1#

能否按照issue模版创建issue,否则好多信息都没有,比如版本之类的。

xurqigkl

xurqigkl2#

Describe the bug
导入v2格式的配置信息,meta 中如果没有 desc 字段,会导致 desc 字段丢失。
Import the configuration information in V2 format. If there is no desc field in meta, the desc field will be lost.

Expected behavior
参考现有 appName字段,如果meta 中 appName = null,则不修改原有的 appName 字段。那么当 meta 中的 desc 字段为空时,是否也应当使用统一逻辑。type 字段由于是通过文件后缀初始化,暂时没有问题。
Refer to the existing appName field. If appName = null in the meta, the original appName field will not be modified. Then, when the desc field in the meta is empty, whether unified logic should also be used. Since the type field is initialized by the file suffix, no problem has been found.

Actually behavior
v2格式导入meta 中appName = null,会清空 desc 字段。
when import with v2, In meta file, if appName is null, the desc field will be lost.

How to Reproduce

  1. 新建包含 归属应用,描述两个字段的配置
    add new config ,and set the appName and desc fields.
  2. 导出v2 格式,并将上述配置 meta 文件中对应的 appName 及 desc 字段移除
    export with v2 format, then remove appName and desc field in the meta file.
  3. 然后导入修改后的zip 包
    then import the zip file.
  4. 此时发现 appName 没有变化,但是 desc 字段被清空了。
    now ,we can find the appName field don't change, but the desc field has been blank.

Desktop (please complete the following information):

  • OS: any
  • Version : newest , develop ,commit id : 3586ad6
  • Module : config
  • SDK : nacos

Additional context
none

mwyxok5s

mwyxok5s3#

@moonciki 除了appName和desc之外,其他字段有没有受影响的?

pes8fvy9

pes8fvy94#

@moonciki 可以将你的commit提一下pr

相关问题