Explorar el Código

feat: config-importer support empty id

LanzaSchneider hace 1 año
padre
commit
b36bb1a44c
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      editor/tools/config-importer.rb

+ 3 - 2
editor/tools/config-importer.rb

@@ -62,13 +62,14 @@ Dir["#{config_path}/*"].each do |path|
       table.fields << field
     end
     # 验证 Id 列
-    next if field_id.nil?
     table.id_field = field_id
     # 处理条目形成引用表
     while !csv.eof?
       line = csv.readline
       next if field_id_name.nil?
-      table.name2id[line[field_id_name.column_id]] = line[field_id.column_id].upcase
+      id = line[field_id.column_id]
+      next if id.nil? || id.empty?
+      table.name2id[line[field_id_name.column_id]] = id.upcase
     end
     # 回滚 csv 状态至表头读取后
     csv.rewind