Check HTTP status code before writing response to file (#8863)
fix https://github.com/jellyfin/jellyfin/issues/8084
This commit is contained in:
parent
8258d884f3
commit
16fdb127ab
|
@ -149,11 +149,11 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||||
|
|
||||||
var url = BaseUrl + "/artist-mb.php?i=" + musicBrainzId;
|
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);
|
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);
|
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
var path = GetArtistInfoPath(_config.ApplicationPaths, musicBrainzId);
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
|
|
||||||
var fileStreamOptions = AsyncFile.WriteOptions;
|
var fileStreamOptions = AsyncFile.WriteOptions;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user