fixed path issue (#157)

Co-authored-by: afkarxyz <mzamzamafkarhadiq@gmail.com>
This commit is contained in:
enriqueqs
2025-12-12 11:31:13 +01:00
committed by GitHub
parent 64b86b65a1
commit ffd4daf031
4 changed files with 14 additions and 12 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ func SanitizeFolderPath(folderPath string) string {
continue continue
} }
// Keep empty string at the start for absolute paths on Unix // Keep empty first part for absolute paths on Unix (e.g., "/Users/...")
if i == 0 && part == "" { if i == 0 && part == "" {
sanitizedParts = append(sanitizedParts, part) sanitizedParts = append(sanitizedParts, part)
continue continue
+2 -4
View File
@@ -130,7 +130,8 @@ export function Settings() {
if (open) { if (open) {
setTempSettings(savedSettings); setTempSettings(savedSettings);
} }
}, [open, savedSettings]); // eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);
const handleSave = () => { const handleSave = () => {
saveSettings(tempSettings); saveSettings(tempSettings);
@@ -187,12 +188,9 @@ export function Settings() {
try { try {
// Call backend to open folder selection dialog // Call backend to open folder selection dialog
const selectedPath = await SelectFolder(tempSettings.downloadPath || ""); const selectedPath = await SelectFolder(tempSettings.downloadPath || "");
console.log("Selected path:", selectedPath);
if (selectedPath && selectedPath.trim() !== "") { if (selectedPath && selectedPath.trim() !== "") {
setTempSettings((prev) => ({ ...prev, downloadPath: selectedPath })); setTempSettings((prev) => ({ ...prev, downloadPath: selectedPath }));
} else {
console.log("No folder selected or user cancelled");
} }
} catch (error) { } catch (error) {
console.error("Error selecting folder:", error); console.error("Error selecting folder:", error);
+6 -2
View File
@@ -22,6 +22,7 @@ export function useDownload() {
const downloadWithAutoFallback = async ( const downloadWithAutoFallback = async (
isrc: string, isrc: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
settings: any, settings: any,
trackName?: string, trackName?: string,
artistName?: string, artistName?: string,
@@ -32,7 +33,7 @@ export function useDownload() {
durationMs?: number, durationMs?: number,
releaseYear?: string releaseYear?: string
) => { ) => {
let service = settings.downloader; const service = settings.downloader;
const query = trackName && artistName ? `${trackName} ${artistName}` : undefined; const query = trackName && artistName ? `${trackName} ${artistName}` : undefined;
const os = settings.operatingSystem; const os = settings.operatingSystem;
@@ -78,6 +79,7 @@ export function useDownload() {
if (service === "auto") { if (service === "auto") {
// Get all streaming URLs once from song.link API // Get all streaming URLs once from song.link API
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let streamingURLs: any = null; let streamingURLs: any = null;
if (spotifyId) { if (spotifyId) {
try { try {
@@ -246,6 +248,7 @@ export function useDownload() {
const downloadWithItemID = async ( const downloadWithItemID = async (
isrc: string, isrc: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
settings: any, settings: any,
itemID: string, itemID: string,
trackName?: string, trackName?: string,
@@ -258,7 +261,7 @@ export function useDownload() {
isAlbum?: boolean, isAlbum?: boolean,
releaseYear?: string releaseYear?: string
) => { ) => {
let service = settings.downloader; const service = settings.downloader;
const query = trackName && artistName ? `${trackName} ${artistName}` : undefined; const query = trackName && artistName ? `${trackName} ${artistName}` : undefined;
const os = settings.operatingSystem; const os = settings.operatingSystem;
@@ -302,6 +305,7 @@ export function useDownload() {
if (service === "auto") { if (service === "auto") {
// Get all streaming URLs once from song.link API // Get all streaming URLs once from song.link API
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let streamingURLs: any = null; let streamingURLs: any = null;
if (spotifyId) { if (spotifyId) {
try { try {