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 <auto@fix.local>
This commit is contained in:
yabo083
2026-01-20 09:54:22 +08:00
committed by GitHub
parent f29f9fff5f
commit 8a7c214296

View File

@@ -45,7 +45,10 @@ const Preview = () => {
const audio = {
name: obj.name,
artist: "Unknown",
url: rawLink(obj, true),
// Use objStore.raw_url for current file (has correct auth tokens from backend)
// Use rawLink for other files in playlist
url:
obj.name === objStore.obj.name ? objStore.raw_url : rawLink(obj, true),
cover: cover,
lrc: lrc,
}