bug(CherryMarkdown): add max allow size parameter on Upload method#760
Merged
bug(CherryMarkdown): add max allow size parameter on Upload method#760
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideCherryMarkdown's Upload method is updated to pass a maximum allowed size to the JS stream's OpenReadStreamAsync call, and the component's copyright header is updated. Sequence diagram for CherryMarkdown Upload max size handlingsequenceDiagram
participant UserComponent
participant CherryMarkdown
participant JSRuntime
participant IJSStreamReference
participant OnFileUploadHandler
UserComponent->>CherryMarkdown: Upload(uploadFile)
activate CherryMarkdown
CherryMarkdown->>JSRuntime: InvokeAsync IJSStreamReference("fetch", Id)
JSRuntime-->>CherryMarkdown: IJSStreamReference stream
alt stream not null
CherryMarkdown->>IJSStreamReference: OpenReadStreamAsync(stream.Length)
IJSStreamReference-->>CherryMarkdown: Stream data
CherryMarkdown->>CherryMarkdown: uploadFile.UploadStream = data
alt OnFileUpload handler exists
CherryMarkdown->>OnFileUploadHandler: Invoke(uploadFile)
OnFileUploadHandler-->>CherryMarkdown: Task completed
end
CherryMarkdown-->>UserComponent: string uploadResult
else stream is null
CherryMarkdown-->>UserComponent: string empty or error
end
deactivate CherryMarkdown
Class diagram for updated CherryMarkdown Upload methodclassDiagram
class CherryMarkdownUploadFile {
Stream UploadStream
}
class CherryMarkdown {
string Id
Func~CherryMarkdownUploadFile, Task~ OnFileUpload
Task~string~ Upload(CherryMarkdownUploadFile uploadFile)
}
class JSRuntime {
Task~IJSStreamReference~ InvokeAsyncIJSStreamReference(string identifier, string id)
}
class IJSStreamReference {
long Length
Task~Stream~ OpenReadStreamAsync(long maxAllowedSize)
}
CherryMarkdown --> CherryMarkdownUploadFile : uses
CherryMarkdown --> JSRuntime : calls
CherryMarkdown --> IJSStreamReference : uses
CherryMarkdownUploadFile --> IJSStreamReference : holds
IJSStreamReference <|.. JSRuntime : returned by
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #759 by fixing a bug in the CherryMarkdown component's file upload functionality. The default maximum size for OpenReadStreamAsync is only 512KB, which causes exceptions when uploading larger files. The fix passes stream.Length as the maxAllowedSize parameter to allow files of any size to be uploaded.
- Added
stream.Lengthparameter toOpenReadStreamAsynccall to support larger file uploads - Updated copyright header to align with newer codebase convention
- Bumped version to 10.0.1
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| CherryMarkdown.razor.cs | Fixed file upload size limitation by passing stream.Length to OpenReadStreamAsync; updated copyright header |
| BootstrapBlazor.CherryMarkdown.csproj | Added version property set to 10.0.1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link issues
fixes #759
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Bug Fixes: