@@ -5,6 +5,7 @@ const { dialog, ipcMain } = require("electron");
5
5
const is = require ( "electron-is" ) ;
6
6
const ytpl = require ( "ytpl" ) ;
7
7
const chokidar = require ( 'chokidar' ) ;
8
+ const filenamify = require ( 'filenamify' ) ;
8
9
9
10
const { setOptions } = require ( "../../config/plugins" ) ;
10
11
const { sendError } = require ( "./back" ) ;
@@ -94,10 +95,10 @@ async function downloadPlaylist(givenUrl, win, options) {
94
95
sendError ( win , e ) ;
95
96
return ;
96
97
}
97
- const playlistTitle = playlist . title ;
98
+ const safePlaylistTitle = filenamify ( playlist . title , { replacement : ' ' } ) ;
98
99
99
100
const folder = getFolder ( options . downloadFolder ) ;
100
- const playlistFolder = join ( folder , playlistTitle ) ;
101
+ const playlistFolder = join ( folder , safePlaylistTitle ) ;
101
102
if ( existsSync ( playlistFolder ) ) {
102
103
sendError (
103
104
win ,
@@ -111,13 +112,13 @@ async function downloadPlaylist(givenUrl, win, options) {
111
112
type : "info" ,
112
113
buttons : [ "OK" ] ,
113
114
title : "Started Download" ,
114
- message : `Downloading Playlist "${ playlistTitle } "` ,
115
+ message : `Downloading Playlist "${ playlist . title } "` ,
115
116
detail : `(${ playlist . items . length } songs)` ,
116
117
} ) ;
117
118
118
119
if ( is . dev ( ) ) {
119
120
console . log (
120
- `Downloading playlist "${ playlistTitle } " - ${ playlist . items . length } songs (${ playlistId } )`
121
+ `Downloading playlist "${ playlist . title } " - ${ playlist . items . length } songs (${ playlistId } )`
121
122
) ;
122
123
}
123
124
@@ -143,7 +144,7 @@ async function downloadPlaylist(givenUrl, win, options) {
143
144
win . webContents . send (
144
145
"downloader-download-playlist" ,
145
146
song . url ,
146
- playlistTitle ,
147
+ safePlaylistTitle ,
147
148
options
148
149
) ;
149
150
} ) ;
0 commit comments