From 43961e83c33c531c4b8b8eb4cf9b04eef38c1191 Mon Sep 17 00:00:00 2001 From: GZTime Date: Mon, 25 Sep 2023 01:35:58 +0800 Subject: [PATCH] fix: cannot list captured traffic --- src/GZCTF/Controllers/GameController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GZCTF/Controllers/GameController.cs b/src/GZCTF/Controllers/GameController.cs index 1bcaad8f9..051c451c3 100644 --- a/src/GZCTF/Controllers/GameController.cs +++ b/src/GZCTF/Controllers/GameController.cs @@ -381,7 +381,7 @@ public async Task GetChallengesWithTrafficCapturing([FromRoute] i [ProducesResponseType(typeof(RequestResponse), StatusCodes.Status404NotFound)] public async Task GetChallengeTraffic([FromRoute] int challengeId, CancellationToken token) { - var filePath = $"{FilePath.Capture}/{challengeId:int}"; + var filePath = $"{FilePath.Capture}/{challengeId}"; if (!Path.Exists(filePath)) return NotFound(new RequestResponse("未找到相关捕获信息", StatusCodes.Status404NotFound)); @@ -412,7 +412,7 @@ public async Task GetChallengeTraffic([FromRoute] int challengeId [ProducesResponseType(typeof(RequestResponse), StatusCodes.Status404NotFound)] public IActionResult GetTeamTraffic([FromRoute] int challengeId, [FromRoute] int partId) { - var filePath = $"{FilePath.Capture}/{challengeId:int}/{partId:int}"; + var filePath = $"{FilePath.Capture}/{challengeId}/{partId}"; if (!Path.Exists(filePath)) return NotFound(new RequestResponse("未找到相关捕获信息", StatusCodes.Status404NotFound)); @@ -438,12 +438,12 @@ public IActionResult GetTeamTraffic([FromRoute] int challengeId, [FromRoute] int public async Task GetTeamTrafficZip([FromRoute] int challengeId, [FromRoute] int partId, CancellationToken token) { - var filePath = $"{FilePath.Capture}/{challengeId:int}/{partId:int}"; + var filePath = $"{FilePath.Capture}/{challengeId}/{partId}"; if (!Path.Exists(filePath)) return NotFound(new RequestResponse("未找到相关捕获信息", StatusCodes.Status404NotFound)); - var filename = $"Capture-{challengeId:int}-{partId:int}-{DateTimeOffset.UtcNow:yyyyMMdd-HH.mm.ssZ}"; + var filename = $"Capture-{challengeId}-{partId}-{DateTimeOffset.UtcNow:yyyyMMdd-HH.mm.ssZ}"; Stream stream = await Codec.ZipFilesAsync(filePath, filename, token); stream.Seek(0, SeekOrigin.Begin); @@ -471,7 +471,7 @@ public IActionResult GetTeamTraffic([FromRoute] int challengeId, [FromRoute] int try { var file = Path.GetFileName(filename); - var path = Path.GetFullPath(Path.Combine(FilePath.Capture, $"{challengeId:int}/{partId:int}", file)); + var path = Path.GetFullPath(Path.Combine(FilePath.Capture, $"{challengeId}/{partId}", file)); if (Path.GetExtension(file) != ".pcap" || !Path.Exists(path)) return NotFound(new RequestResponse("未找到相关捕获信息"));