delete empty files on failed downloads
This commit is contained in:
@@ -50,6 +50,8 @@ public partial class ApiController
|
|||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
var fileName = Path.GetTempFileName();
|
var fileName = Path.GetTempFileName();
|
||||||
|
try
|
||||||
|
{
|
||||||
var fileStream = File.Create(fileName);
|
var fileStream = File.Create(fileName);
|
||||||
await using (fileStream.ConfigureAwait(false))
|
await using (fileStream.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
@@ -69,6 +71,12 @@ public partial class ApiController
|
|||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
File.Delete(fileName);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int GetDownloadId() => _downloadId++;
|
public int GetDownloadId() => _downloadId++;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user