🐞 fix: 修复文件名不正确的问题

This commit is contained in:
秋刀鱼 2024-11-13 16:10:02 +08:00
parent e0c87d6db6
commit 18da75b87a

View File

@ -419,9 +419,8 @@ export class songRequest extends plugin {
// 获取文件名 // 获取文件名
const fileName = cleanPath.split('/').pop().replace(/\.\w+$/, ''); const fileName = cleanPath.split('/').pop().replace(/\.\w+$/, '');
logger.info(fileName) logger.info(fileName)
const parts = fileName.match(/([\u4e00-\u9fa5a-zA-Z0-9]+)\s*-\s*([\u4e00-\u9fa5a-zA-Z0-9]+)/); const parts = fileName.trim().match(/^\s*([\u4e00-\u9fa5a-zA-Z0-9]+)\s*-\s*([\u4e00-\u9fa5a-zA-Z0-9]+)\s*$/);
logger.info(parts) logger.info(parts)
logger.info(parts[1].trim())
const newFileName = dirPath + '/' + parts[2].trim() + extension const newFileName = dirPath + '/' + parts[2].trim() + extension
// 进行元数据编辑 // 进行元数据编辑
if (parts) { if (parts) {