fix error

This commit is contained in:
chiu 2021-09-06 05:54:59 +00:00
parent 8d03a48dc4
commit 3b72c497fe
1 changed files with 3 additions and 2 deletions

View File

@ -26,9 +26,10 @@ if bundle_update_flag
update_flag = false update_flag = false
last_index = widget_info[-1]["filename"].match(/\d+/)[0].to_i rescue nil last_index = widget_info[-1]["filename"].match(/\d+/)[0].to_i rescue nil
if !last_index.nil? if !last_index.nil?
idx_regex = /^(\d+[\. \t]*)|[ \t]+$/
default_gallery_widget_info.each do |h| default_gallery_widget_info.each do |h|
name_without_index = h["name"]["zh_tw"].sub(/\d+/,'') name_without_index = h["name"]["zh_tw"].gsub(idx_regex,'')
widget_info_index = (widget_info.index{|hh| hh["name"]["zh_tw"].include?(name_without_index)} rescue -1) widget_info_index = (widget_info.index{|hh| hh["name"]["zh_tw"].gsub(idx_regex,'') == name_without_index}||-1 rescue -1)
if (widget_info_index == -1 || widget_info_index.nil?) if (widget_info_index == -1 || widget_info_index.nil?)
update_flag = true update_flag = true
copy_h = h.dup copy_h = h.dup