fix(server): answer every chunk request and out-of-range archive.json policies
The chunk endpoint raised the request body limit only before reading a chunk. A chunk sent again after a lost answer, or to an unknown or finished upload, was left unread above Kestrel's 1 MiB default, so Kestrel closed the connection instead of delivering the answer. The limit is now raised before any answer, to the larger of the upload's and the server's chunk size, and never lowered. PUT /api/v1/archive/settings answered 500 when archive.json held a thumbnail size or proxy quality out of range, which the admin API cannot set. It now answers 409 archive_policy with the policy to correct in details (Server.Error.ArchivePolicy). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
7 files changed
+62
-4
No files matched your search
@@ -177,5 +177,21 @@ public sealed class AdminTests(TestContext context)
|
||||
{
|
||||
await File.WriteAllBytesAsync(path, saved, context.Cancellation);
|
||||
}
|
||||
|
||||
// A policy this form cannot set, written out of range by another tool, is named so the admin can correct the file.
|
||||
var current = Titano.Core.Archiving.ManifestStore.ReadArchive(path);
|
||||
foreach (var (odd, property) in new[]
|
||||
{
|
||||
(current with { ThumbnailPolicy = new Titano.Core.Archiving.ThumbnailPolicy { LongEdge = 2048 } }, "thumbnailPolicy"),
|
||||
(current with { ProxyPolicy = current.ProxyPolicy with { Quality = 0 } }, "proxyPolicy"),
|
||||
})
|
||||
{
|
||||
Titano.Core.Archiving.ManifestStore.WriteArchive(path, odd);
|
||||
var before = await File.ReadAllBytesAsync(path, context.Cancellation);
|
||||
using var refused = await admin.PutAsJsonAsync("/api/v1/archive/settings", changed with { ProxyLongEdge = 1280 }, ProtocolJson.Default.ArchiveSettingsDto);
|
||||
Assert.Equal(property, (await refused.ExpectErrorAsync(HttpStatusCode.Conflict, "archive_policy")).Details);
|
||||
Assert.SequenceEqual(before, await File.ReadAllBytesAsync(path, context.Cancellation));
|
||||
}
|
||||
await File.WriteAllBytesAsync(path, saved, context.Cancellation);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user