fix(server): render uploads need Edit; chunks keep their upload's size
POST /sequences/{id}/renders and its complete call accepted the Upload
permission, so an upload-only account could file render outputs, which count
against no quota, into any sequence. Client renders are sent by the sync of
an editor's copy: both calls now require Edit (SRV-4).
The chunk endpoint capped the body at the current chunk size, while an
upload keeps the size it started with; after an administrator lowered the
setting, every chunk of an upload in flight got 413 until the upload expired.
The service now raises the limit to that upload's own chunk size before it
reads the body (SRV-5).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
4 files changed
+61
-8
No files matched your search
@@ -1,7 +1,5 @@
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Protocol;
|
||||
using Titano.Server.Configuration;
|
||||
using Titano.Server.Security;
|
||||
using Titano.Server.Storage;
|
||||
|
||||
@@ -34,10 +32,12 @@ public static class UploadEndpoints
|
||||
statusCode: r.AlreadyExists ? StatusCodes.Status200OK : StatusCodes.Status201Created));
|
||||
}
|
||||
|
||||
private static async Task<IResult> ChunkAsync(HttpContext context, Caller caller, Guid id, int index, UploadService service, ServerOptions options)
|
||||
/// <summary>
|
||||
/// Chunks are the only large request bodies; every other endpoint keeps Kestrel's small default limit. The service
|
||||
/// raises it to the chunk size of this upload (fixed when it started) before it reads the body.
|
||||
/// </summary>
|
||||
private static async Task<IResult> ChunkAsync(HttpContext context, Caller caller, Guid id, int index, UploadService service)
|
||||
{
|
||||
// Chunks are the only large request bodies; every other endpoint keeps Kestrel's small default limit.
|
||||
if (context.Features.Get<IHttpMaxRequestBodySizeFeature>() is { IsReadOnly: false } limit) limit.MaxRequestBodySize = options.ChunkSizeBytes;
|
||||
var outcome = await service.ReceiveChunkAsync(caller, id, index, context.Request, context.RequestAborted);
|
||||
return outcome.ToResult(context, r => Results.Json(r, ProtocolJson.Default.ChunkReceived));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user