Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DOWNLOAD_MISSING_BEATMAPS env var #20

Merged
merged 6 commits into from
May 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix empty beatmap check occuring before streaming
Syriiin committed May 18, 2024
commit 483ab50f6ddc2447eb02892afeed886d935add5f
5 changes: 2 additions & 3 deletions Difficalcy/Services/WebBeatmapProvider.cs
Original file line number Diff line number Diff line change
@@ -17,14 +17,13 @@ public async Task EnsureBeatmap(string beatmapId)
if (!File.Exists(beatmapPath))
{
using var response = await _httpClient.GetAsync($"https://osu.ppy.sh/osu/{beatmapId}");
if (!response.IsSuccessStatusCode)
if (!response.IsSuccessStatusCode || response.Content.Headers.ContentLength == 0)
throw new BadHttpRequestException("Beatmap not found");

using var fs = new FileStream(beatmapPath, FileMode.CreateNew);
await response.Content.CopyToAsync(fs);
if (fs.Length == 0)
throw new BadHttpRequestException("Beatmap not found");

await response.Content.CopyToAsync(fs);
}
}