-
Notifications
You must be signed in to change notification settings - Fork 397
Fix Max Upload Size handling #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace Microsoft.KernelMemory.Configuration; | ||
|
|
@@ -30,18 +29,8 @@ public class ServiceConfig | |
| public Dictionary<string, HandlerConfig> Handlers { get; set; } = new(); | ||
|
|
||
| /// <summary> | ||
| /// The maximum allowed size in megabytes for a request body posted to the upload endpoint. | ||
| /// The maximum allowed size in bytes for a request body posted to the upload endpoint. | ||
| /// If not set the solution defaults to 30,000,000 bytes (~28.6 MB) (ASP.NET default). | ||
| /// </summary> | ||
| public long? MaxUploadSizeMb { get; set; } = null; | ||
|
|
||
| public long? GetMaxUploadSizeInBytes() | ||
| { | ||
| if (this.MaxUploadSizeMb.HasValue) | ||
| { | ||
| return Math.Min(10, this.MaxUploadSizeMb.Value) * 1024 * 1024; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the only line that needs fixing, using
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So don't you want to handle scenarios where, for example, I need to limit the upload to 1 MB? |
||
| } | ||
|
|
||
| return null; | ||
| } | ||
| public long? MaxUploadSize { get; set; } = null; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as per conversation, I'd prefer sticking to "megabytes"