修复我的列表搜索输入某些字符会导致应用崩溃的问题

This commit is contained in:
lyswhut 2021-10-03 10:54:47 +08:00
parent 2f769d3936
commit f9cb322abe
2 changed files with 2 additions and 8 deletions

View File

@ -1,9 +1,3 @@
### 优化
- 缓冲进度条颜色
- 优化数据存储,若需要存储的数据过大时会将数据切片后存储,现在存储大列表不会导致列表丢失了
### 修复
- 修复随机播放模式下在同列表切其他歌曲不会清空已播放列表的问题
- 修复歌曲播放出错时的URL刷新问题
- 修复我的列表搜索输入某些字符会导致应用崩溃的问题

View File

@ -65,7 +65,7 @@ const handleSortList = (list, keyword) => {
export const debounceSearchList = debounce((text, list, callback) => {
const reslutList = []
if (!text.length) return
let rxp = new RegExp(text.split('').join('.*') + '.*', 'i')
let rxp = new RegExp(text.split('').map(s => s.replace(/[.*+?^${}()|[\]\\]/, '\\$&')).join('.*') + '.*', 'i')
for (const item of list) {
if (rxp.test(`${item.name}${item.singer}${item.albumName ? item.albumName : ''}`)) reslutList.push(item)
}