Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Sep 30, 2023
1 parent 7094ef1 commit 534bcd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ private async Task<string> GenerateFileId(CancellationToken ct)
public async Task<IActionResult> CrashUploadAsync(CancellationToken ct)
{
if (Request.ContentLength is not { } contentLength || contentLength < _options.MinContentLength || contentLength > _options.MaxContentLength)
return StatusCode((int) HttpStatusCode.InternalServerError);
return StatusCode(StatusCodes.Status500InternalServerError);

Request.EnableBuffering();

var (valid, id, version, crashReportModel) = await CrashReportRawParser.TryReadCrashReportDataAsync(PipeReader.Create(Request.Body));
if (!valid)
return StatusCode((int) HttpStatusCode.InternalServerError);
return StatusCode(StatusCodes.Status500InternalServerError);

if (await _dbContext.Set<IdEntity>().FirstOrDefaultAsync(x => x.CrashReportId == id, ct) is { } idEntity)
return Ok($"{_options.BaseUri}/{idEntity.FileId}");
Expand Down Expand Up @@ -104,7 +104,7 @@ public async Task<IActionResult> CrashUploadAsync(CancellationToken ct)
public async Task<IActionResult> CrashUploadAsync([FromBody] CrashReportUploadBody body, CancellationToken ct)
{
if (Request.ContentLength is not { } contentLength || contentLength < _options.MinContentLength || contentLength > _options.MaxContentLength)
return StatusCode((int) HttpStatusCode.InternalServerError);
return StatusCode(StatusCodes.Status500InternalServerError);

if (await _dbContext.Set<IdEntity>().FirstOrDefaultAsync(x => x.CrashReportId == body.CrashReport.Id, ct) is { } idEntity)
return Ok($"{_options.BaseUri}/{idEntity.FileId}");
Expand Down
3 changes: 1 addition & 2 deletions src/BUTR.CrashReportServer/Controllers/ReportController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ public ActionResult<IEnumerable<FilenameDate>> GetFilenameDates(ICollection<stri
.Where(x => filenamesWithExtension.Contains(x.FileId))
.Select(x => new { x.FileId, x.Created })
.AsAsyncEnumerable()
.Select(x => new FilenameDate(x.FileId, x.Created.ToUniversalTime().ToString("O")))
.WithCancellation(ct));
.Select(x => new FilenameDate(x.FileId, x.Created.ToUniversalTime().ToString("O"))));
}
}

0 comments on commit 534bcd6

Please sign in to comment.