Skip to content

Fix: remove redundant OpenRead preflight for audio download - #12

Merged
qew21 merged 1 commit into
qew21:masterfrom
GinForGit:fix/audio-network-preflight
Jul 12, 2026
Merged

Fix: remove redundant OpenRead preflight for audio download#12
qew21 merged 1 commit into
qew21:masterfrom
GinForGit:fix/audio-network-preflight

Conversation

@GinForGit

Copy link
Copy Markdown
Contributor

Problem

PlayAudioFromUrl currently calls webClient.OpenRead(url).Close() before the actual DownloadFile. This is a GET request that is discarded immediately, so every audio triggers two HTTP requests instead of one. The endpoint also returns 405 Method Not Allowed for HEAD, so the preflight is not a cheap HEAD check.

Solution

  • Remove the OpenRead preflight.
  • Download directly with WebClient.DownloadFile.
  • Catch WebException with status 404 to skip missing audio files cleanly.
  • Add a User-Agent header to avoid being blocked by CDN/server.

Note

This branch is based on #11 and will show only the network fix once #11 is merged.

Testing

  • Verified with curl that the server accepts GET with the new User-Agent and returns 404 for unknown md5.
  • Build passes (excluding unrelated WixSharp SDK project).

@GinForGit GinForGit closed this Jul 12, 2026
@GinForGit GinForGit reopened this Jul 12, 2026
- Replace the OpenRead()+Close() URL check with a single DownloadFile call.

- Catch WebException with 404 to skip missing audio files cleanly.

- Add a User-Agent header to avoid being blocked by CDN/server.
@GinForGit
GinForGit force-pushed the fix/audio-network-preflight branch from 41c7163 to 817b999 Compare July 12, 2026 09:54
@qew21
qew21 self-requested a review July 12, 2026 10:52
@qew21
qew21 merged commit 45591c2 into qew21:master Jul 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants