Skip to content

Commit 8a7c214

Browse files
yabo083Auto-fix
andauthored
fix: use objStore.raw_url for current audio in share links (#363)
Problem: Audio files couldn't play from share links (/@s/share_id) returning HTTP 500 errors. Root Cause: The audio preview component used rawLink(obj, true) to construct the audio URL. However, rawLink() generates URLs by concatenating paths on the frontend, which may lack proper authentication tokens or have incorrect path structure for share links. Other preview components (video, image, doc, etc.) correctly use objStore.raw_url, which is the complete download URL returned by the backend API with proper authentication already applied. Solution: For the currently selected audio file, use objStore.raw_url (backend-provided URL). For other files in the playlist, continue using rawLink() as before. This aligns the audio preview behavior with other preview components. Co-authored-by: Auto-fix <[email protected]>
1 parent f29f9ff commit 8a7c214

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pages/home/previews/audio.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ const Preview = () => {
4545
const audio = {
4646
name: obj.name,
4747
artist: "Unknown",
48-
url: rawLink(obj, true),
48+
// Use objStore.raw_url for current file (has correct auth tokens from backend)
49+
// Use rawLink for other files in playlist
50+
url:
51+
obj.name === objStore.obj.name ? objStore.raw_url : rawLink(obj, true),
4952
cover: cover,
5053
lrc: lrc,
5154
}

0 commit comments

Comments
 (0)