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