Skip to content

Commit 9bda4b0

Browse files
authored
chore: correct zip download to avoid conflict (#287)
2 parents efa2ed7 + 54dc714 commit 9bda4b0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Common/ArmoniK.EndToEndTests.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
2020
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
2121
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
22-
<PackageReference Include="System.Text.Json" Version="8.0.3" />
22+
<PackageReference Include="System.Text.Json" Version="8.0.4" />
2323
</ItemGroup>
2424

2525
<ItemGroup>

Worker/src/Common/Adapter/S3Adapter.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ public async Task DownloadFileAsync(string fileName)
103103
});
104104
var stream2 = new BufferedStream(r.ResponseStream);
105105

106+
var materializedFileName = fileName + Guid.NewGuid();
107+
106108
var file = new FileStream(Path.Combine(LocalZipDir,
107-
fileName),
109+
materializedFileName),
108110
FileMode.Create,
109111
FileAccess.Write);
110112
try
@@ -133,5 +135,10 @@ public async Task DownloadFileAsync(string fileName)
133135

134136
throw new Exception("Error occurred: " + amazonS3Exception.Message);
135137
}
138+
139+
File.Move(Path.Combine(LocalZipDir,
140+
materializedFileName),
141+
Path.Combine(LocalZipDir,
142+
fileName));
136143
}
137144
}

0 commit comments

Comments
 (0)