merge: deterministic sync tests and a current-log download that survives new lines
This commit is contained in:
5 files changed
+175
-27
No files matched your search
@@ -29,10 +29,11 @@ public static class AdminEndpoints
|
||||
ProtocolJson.Default.ListLogFileDto));
|
||||
logs.MapGet("/files/{name}", (HttpContext context, string name, ServerOptions options) =>
|
||||
{
|
||||
// Only names of existing log files are served: the name never becomes part of a path.
|
||||
// Only names of existing log files are served: the name never becomes part of a path. The current log keeps
|
||||
// growing while it is sent, so the response holds the bytes it had when listed, as its Content-Length says.
|
||||
if (LogFiles(options).FirstOrDefault(f => f.Name == name) is not { } file) return ApiErrors.NotFound(context, "log");
|
||||
context.Response.Headers.CacheControl = "no-store";
|
||||
return Results.File(file.FullName, "text/plain; charset=utf-8", file.Name, file.LastWriteTimeUtc, enableRangeProcessing: true);
|
||||
return FileResponses.Serve(context, file, 0, file.Length, "text/plain; charset=utf-8", "no-store", downloadName: file.Name)
|
||||
?? ApiErrors.NotFound(context, "log");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user