From e49c54c8aa2a710ab8bd1748ce223bd484c04b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Fri, 17 Nov 2023 07:19:20 +0800 Subject: [PATCH] Fix author text bug. --- app/helpers/admin/personal_books_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/admin/personal_books_helper.rb b/app/helpers/admin/personal_books_helper.rb index b834642..185d25d 100644 --- a/app/helpers/admin/personal_books_helper.rb +++ b/app/helpers/admin/personal_books_helper.rb @@ -10,7 +10,7 @@ module Admin::PersonalBooksHelper end full_authors_names = get_member(book).collect do |member| member_name = member.name - idx = authors_names.index{|a| a.match(/(^|[ \(\[])#{member_name}([ \)\]\*]|$)/)} + idx = authors_names.index{|a| a.match(/(^|[ \(\[])#{::Regexp.escape(member_name)}([ \)\]\*]|$)/)} if idx member_name = authors_names[idx] authors_names[idx] = nil @@ -31,7 +31,7 @@ module Admin::PersonalBooksHelper end full_authors = get_member(book).collect do |member| member_name = member.name - idx = authors_names.index{|a| a.match(/(^|[ \(\[])#{member_name}([ \)\]\*]|$)/)} + idx = authors_names.index{|a| a.match(/(^|[ \(\[])#{::Regexp.escape(member_name)}([ \)\]\*]|$)/)} if idx member_name = authors_names[idx] authors_names[idx] = nil