Fix upload archive being deleted before disposed
This commit is contained in:
parent
54acf8e60c
commit
f802448aaa
2 changed files with 10 additions and 5 deletions
|
|
@ -15,9 +15,17 @@ public class ImportService<T>(
|
|||
{
|
||||
var importArchive = await archiveService.FirstOrDefaultAsync(a => a.ObjectKey == objectKey.ToString());
|
||||
var importArchivePath = await archiveService.GetArchiveFileLocationAsync(importArchive);
|
||||
|
||||
T entity;
|
||||
|
||||
using var importZip = ZipFile.OpenRead(importArchivePath);
|
||||
return await importer.ImportAsync(objectKey, importZip);
|
||||
using (var importZip = ZipFile.OpenRead(importArchivePath))
|
||||
{
|
||||
entity = await importer.ImportAsync(objectKey, importZip);
|
||||
}
|
||||
|
||||
await archiveService.DeleteAsync(importArchive);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<T> ImportFromLocalFileAsync(string localFilePath)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ public class GameImporter(
|
|||
public async Task<Game> ImportAsync(Guid objectKey, ZipArchive importZip)
|
||||
{
|
||||
var importArchive = await archiveService.FirstOrDefaultAsync(a => a.ObjectKey == objectKey.ToString());
|
||||
var importArchivePath = await archiveService.GetArchiveFileLocationAsync(importArchive);
|
||||
var storageLocation = await storageLocationService.GetAsync(importArchive.StorageLocationId);
|
||||
|
||||
var manifest = ManifestHelper.Deserialize<GameManifest>(await importZip.ReadAllTextAsync(ManifestHelper.ManifestFilename));
|
||||
|
|
@ -45,8 +44,6 @@ public class GameImporter(
|
|||
game = await UpdateCollections(game, manifest);
|
||||
game = await UpdateDependentGames(game, manifest);
|
||||
|
||||
await archiveService.DeleteAsync(importArchive, storageLocation);
|
||||
|
||||
return game;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue