fix: path sanitization inconsistency in cover art lookup

Cover art lookup was constructing paths from raw metadata without
sanitization, causing "No such file or directory" errors for artists
with special characters (e.g. "Au/Ra" looked for "Au/Ra/" but files
were saved to "Au_Ra/"). Now uses sanitizeFilename() to match the
actual on-disk folder structure created during downloads.
This commit is contained in:
2025-10-04 14:43:54 -04:00
parent 26c465118b
commit 480aa5859b

View File

@@ -2,6 +2,7 @@ import { readTextFile, exists, readDir } from '@tauri-apps/plugin-fs';
import { invoke } from '@tauri-apps/api/core';
import type { Track, AudioFormat, PlaylistWithTracks, TrackMetadata } from '$lib/types/track';
import { findAlbumArt } from './album';
import { sanitizeFilename } from '$lib/services/deezer/paths';
/**
* Get audio format from file extension
@@ -228,7 +229,8 @@ export async function findPlaylistCoverFallback(
}
// Construct album folder path following the same structure as downloader
const albumPath = `${musicFolder}/${albumArtist}/${album}`;
// Must use sanitized paths to match how files are actually saved on disk
const albumPath = `${musicFolder}/${sanitizeFilename(albumArtist)}/${sanitizeFilename(album)}`;
try {
// Check if album folder exists and has cover art