Compare commits

...

2 Commits

Author SHA1 Message Date
MathieuG-P 4a977332c9 update to v1.4.12 2024-11-05 20:53:50 +01:00
MathieuG-P 81c5a7928a 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

(cherry picked from commit d5f2ba3b21)
2024-11-05 20:53:12 +01:00
4 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "bs-manager",
"version": "1.4.11",
"version": "1.4.12",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "bs-manager",
"version": "1.4.11",
"version": "1.4.12",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "bs-manager",
"version": "1.4.11",
"version": "1.4.12",
"description": "BSManager",
"main": "./dist/main/main.js",
"author": {
@@ -13,6 +13,7 @@ import { BeatSaverService } from "../thrid-party/beat-saver/beat-saver.service";
import { copy, copyFile, pathExists, realpath } from "fs-extra";
import { Progression, ensureFolderExist, pathExist } from "../../helpers/fs.helpers";
import { IpcService } from "../ipc.service";
import sanitize from "sanitize-filename";
export class LocalPlaylistsManagerService {
private static instance: LocalPlaylistsManagerService;
@@ -71,12 +72,13 @@ export class LocalPlaylistsManagerService {
private async installBPListFile(bslistSource: string, version: BSVersion): Promise<string> {
const playlistFolder = await this.getPlaylistsFolder(version);
const isLocalFile = await pathExists(bslistSource).catch(e => { log.error(e); return false; });
const filename = isLocalFile ? path.basename(bslistSource) : new URL(bslistSource).pathname.split('/').pop()
const filename = isLocalFile ? path.basename(bslistSource) : sanitize(new URL(bslistSource).pathname.split('/').pop())
const destFile = path.join(playlistFolder, filename);
if (isLocalFile) {
return copyFile(bslistSource, destFile).then(() => destFile);
}
return lastValueFrom(this.request.downloadFile(bslistSource, {
destFolder: playlistFolder,
filename,
+3 -2
View File
@@ -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);
};