fix(17-02): fix cover art replace and remove

Three issues fixed:

1. asBytes() helper for []interface{} → []byte conversion — same
   float64 deserialization issue as numeric fields. Cover art data
   from the frontend arrives as []interface{} of float64, not []byte.

2. DB sync for cover art — was a placeholder no-op. Now saves image
   to covers cache dir (content-hash dedup + thumbnail generation),
   upserts cover_art row, and updates release_groups.cover_art_id.
   Clear sets cover_art_id to NULL on linked release groups.

3. Frontend ReadFile returns base64 string (Go []byte JSON encoding),
   not number[]. Decode with atob() before creating Uint8Array for
   preview blob URL.
This commit is contained in:
2026-03-18 10:36:17 -04:00
parent 900db2e56c
commit d7c2965752
5 changed files with 220 additions and 11 deletions
@@ -996,11 +996,19 @@ export class TrackDetails extends LitElement {
filePath: string,
): Promise<Uint8Array | null> {
try {
// ReadFile returns number[] (Go []byte serialized
// as JSON array).
const bytes = await ReadFile(filePath);
// ReadFile returns Go []byte which Wails serializes
// as a base64-encoded string (standard encoding/json
// behaviour for []byte).
const result = await ReadFile(filePath);
const b64 = result as unknown as string;
const binary = atob(b64);
const bytes = new Uint8Array(binary.length);
return new Uint8Array(bytes);
for (let i = 0; i < binary.length; i++) {
bytes[i] = binary.charCodeAt(i);
}
return bytes;
} catch (err) {
console.error(
'Failed to read cover art file:',