Skip to content

Commit

Permalink
[fix]: fix special charactors
Browse files Browse the repository at this point in the history
  • Loading branch information
oooohhoo committed Sep 9, 2024
1 parent 1c35b9d commit daa8214
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ ipcMain.on("downloadMusic", (event, {data, musicCacheDir, cacheOnlyMode}) => {
if (!data.album){
data.album = "未知"
}
data.artist = data.artist.trim().replaceAll("/","|");
data.album = data.album.trim().replaceAll("/","|");
const music_dir = join(musicCacheDir, data.artist, data.album);
if (!fs.existsSync(music_dir)){
fs.mkdirSync(music_dir,{ recursive: true });
Expand All @@ -784,7 +786,7 @@ ipcMain.on("downloadMusic", (event, {data, musicCacheDir, cacheOnlyMode}) => {
const filename = headerLine.substring(headerLine.indexOf('"') + 1, headerLine.lastIndexOf('"'));
ext = extname(filename)||ext;
}
const music_path = join(music_dir, data.title + ext);
const music_path = join(music_dir, data.title.trim().replaceAll("/","|") + ext);
response.pipe(fs.createWriteStream(music_path)).on("close", () => {
const tagData = {
title: data.title,
Expand Down

0 comments on commit daa8214

Please sign in to comment.