nacos icon indicating copy to clipboard operation
nacos copied to clipboard

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

Open moonciki opened this issue 3 years ago • 2 comments

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

moonciki avatar Aug 09 '22 09:08 moonciki

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

KomachiSion avatar Aug 10 '22 02:08 KomachiSion

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 : 3586ad64c9d8892301efa9cc893c9ea9625712b2
  • Module : config
  • SDK : nacos

Additional context none

moonciki avatar Aug 10 '22 08:08 moonciki

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

realJackSun avatar Sep 13 '22 02:09 realJackSun

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

realJackSun avatar Sep 13 '22 02:09 realJackSun