mirror of
https://github.com/markuryy/shark.git
synced 2025-12-12 11:41:02 +00:00
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:
@@ -2,6 +2,7 @@ import { readTextFile, exists, readDir } from '@tauri-apps/plugin-fs';
|
|||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import type { Track, AudioFormat, PlaylistWithTracks, TrackMetadata } from '$lib/types/track';
|
import type { Track, AudioFormat, PlaylistWithTracks, TrackMetadata } from '$lib/types/track';
|
||||||
import { findAlbumArt } from './album';
|
import { findAlbumArt } from './album';
|
||||||
|
import { sanitizeFilename } from '$lib/services/deezer/paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get audio format from file extension
|
* Get audio format from file extension
|
||||||
@@ -228,7 +229,8 @@ export async function findPlaylistCoverFallback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct album folder path following the same structure as downloader
|
// 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 {
|
try {
|
||||||
// Check if album folder exists and has cover art
|
// Check if album folder exists and has cover art
|
||||||
|
|||||||
Reference in New Issue
Block a user