mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Merge pull request #645 from Zagrios/bugfix/fix-oneclick-download-playlist-broken
[bugfix] Fix broken oneclick playlist download + issue with specials chars in playlists filenames
This commit is contained in:
@@ -123,7 +123,7 @@ export class LocalPlaylistsManagerService {
|
||||
const dest = await (async () => {
|
||||
if(opt.dest && path.isAbsolute(opt.dest) && this.acceptPlaylistFiletype(opt.dest)) { return opt.dest; }
|
||||
const playlistFolder = await this.getPlaylistsFolder(opt.version);
|
||||
return path.join(playlistFolder, filename);
|
||||
return path.join(playlistFolder, sanitize(filename));
|
||||
})();
|
||||
|
||||
writeFileSync(dest, JSON.stringify(bpList, null, 2));
|
||||
|
||||
@@ -8,6 +8,7 @@ import { unlinkSync } from "fs-extra";
|
||||
import { tryit } from "shared/helpers/error.helpers";
|
||||
import path from "path";
|
||||
import { pipeline } from "stream/promises";
|
||||
import sanitize from "sanitize-filename";
|
||||
|
||||
export class RequestService {
|
||||
private static instance: RequestService;
|
||||
@@ -66,7 +67,7 @@ export class RequestService {
|
||||
const filename = opt?.preferContentDisposition ? this.getFilenameFromContentDisposition(response.headers["content-disposition"]) : null;
|
||||
|
||||
if (filename) {
|
||||
dest = path.join(path.dirname(dest), filename);
|
||||
dest = path.join(path.dirname(dest), sanitize(filename));
|
||||
}
|
||||
|
||||
progress.data = dest;
|
||||
|
||||
+3
-2
@@ -8,8 +8,9 @@ export function resolveHtmlPath (htmlFileName: string) {
|
||||
const url = new URL(`http://localhost:${port}/${htmlFileName}`);
|
||||
return url.toString();
|
||||
}
|
||||
const filePath = path.resolve(__dirname, "..", "renderer", htmlFileName);
|
||||
return pathToFileURL(filePath).toString();
|
||||
|
||||
const filePath = path.resolve(__dirname, "..", "renderer");
|
||||
return pathToFileURL(filePath).toString().concat("/", htmlFileName);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user