Check HTTP status code before writing response to file (#8863)

fix https://github.com/jellyfin/jellyfin/issues/8084
pull/8870/head
Bond-009 2 years ago committed by GitHub
parent 8258d884f3
commit 16fdb127ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -149,11 +149,11 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
var url = BaseUrl + "/artist-mb.php?i=" + musicBrainzId;
var path = GetArtistInfoPath(_config.ApplicationPaths, musicBrainzId);
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
var path = GetArtistInfoPath(_config.ApplicationPaths, musicBrainzId);
Directory.CreateDirectory(Path.GetDirectoryName(path));
var fileStreamOptions = AsyncFile.WriteOptions;

Loading…
Cancel
Save