diff --git a/src/GZCTF/Repositories/FileRepository.cs b/src/GZCTF/Repositories/FileRepository.cs index 662488594..86f40b78a 100644 --- a/src/GZCTF/Repositories/FileRepository.cs +++ b/src/GZCTF/Repositories/FileRepository.cs @@ -134,19 +134,19 @@ async Task StoreLocalFile(string fileName, Stream contentStream, Canc { localFile = new() { Hash = fileHash, Name = fileName, FileSize = contentStream.Length }; await context.AddAsync(localFile, token); + } - var path = Path.Combine(FilePath.Uploads, localFile.Location); + var path = Path.Combine(FilePath.Uploads, localFile.Location); - if (!Directory.Exists(path)) - Directory.CreateDirectory(path); + if (!Directory.Exists(path)) + Directory.CreateDirectory(path); - using FileStream fileStream = File.Create(Path.Combine(path, localFile.Hash)); + using FileStream fileStream = File.Create(Path.Combine(path, localFile.Hash)); - contentStream.Position = 0; - await contentStream.CopyToAsync(fileStream, token); - } + contentStream.Position = 0; + await contentStream.CopyToAsync(fileStream, token); await SaveAsync(token); return localFile; } -} \ No newline at end of file +}