mirror of
https://github.com/Readarr/Readarr
synced 2025-12-15 12:52:27 +01:00
Revert "Fixed: Corrupt image files when downloading from redirecting Url"
This reverts commit 79dfd8f14d.
This commit is contained in:
parent
99a2e1f0fa
commit
529ffa8864
2 changed files with 1 additions and 27 deletions
|
|
@ -322,31 +322,6 @@ public void should_not_download_file_with_error()
|
|||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_write_redirect_content_to_stream()
|
||||
{
|
||||
var file = GetTempFilePath();
|
||||
|
||||
using (var fileStream = new FileStream(file, FileMode.Create))
|
||||
{
|
||||
var request = new HttpRequest($"http://{_httpBinHost}/redirect/1");
|
||||
request.AllowAutoRedirect = false;
|
||||
request.ResponseStream = fileStream;
|
||||
|
||||
var response = Subject.Get(request);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Redirect);
|
||||
}
|
||||
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
|
||||
File.Exists(file).Should().BeTrue();
|
||||
|
||||
var fileInfo = new FileInfo(file);
|
||||
|
||||
fileInfo.Length.Should().Be(0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_send_cookie()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -127,10 +127,9 @@ public HttpResponse GetResponse(HttpRequest request, CookieContainer cookies)
|
|||
{
|
||||
try
|
||||
{
|
||||
if (request.ResponseStream != null && httpWebResponse.StatusCode == HttpStatusCode.OK)
|
||||
if (request.ResponseStream != null)
|
||||
{
|
||||
// A target ResponseStream was specified, write to that instead.
|
||||
// But only on the OK status code, since we don't want to write failures and redirects.
|
||||
responseStream.CopyTo(request.ResponseStream);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue