Skip to content
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

BUnitBrowserFile ignores MaximumAllowedFileSize #1503

Closed
MorneZaayman opened this issue Jul 18, 2024 · 8 comments · Fixed by #1504
Closed

BUnitBrowserFile ignores MaximumAllowedFileSize #1503

MorneZaayman opened this issue Jul 18, 2024 · 8 comments · Fixed by #1504
Assignees
Labels
bug Something isn't working

Comments

@MorneZaayman
Copy link

When testing the MaximumAllowedFileSize for a component that includes an InputFile component, I picked up that the BUnit.BUnitBrowserFile implementation ignores the MaximumAllowedFileSize argument, and allows any file size to be uploaded.

To replicate, you need to render a component containing an InputFile component (or the InputFile component directly), and set the MaximumAllowedFileSize to something small, say 512 (bytes). Then generate a random file containing say 1024 bytes and upload it. The BUnitBrowserFile implementation allows the file to be uploaded.

Expected behavior:

The BUnitBrowserFile implementation throws an exception just like the built in Blazor InputFile component does.

Version info:

  • bUnit version: 1.29.5
  • .NET Runtime and Blazor version: 8 with Blazor WASM
  • OS type and version: Windows 11 23H2
@linkdotnet
Copy link
Collaborator

Hey @MorneZaayman

That is a fair point. That said - I will provide a fix that will throw in your described case.

@linkdotnet linkdotnet self-assigned this Jul 19, 2024
@linkdotnet linkdotnet added the bug Something isn't working label Jul 19, 2024
@MorneZaayman
Copy link
Author

Dankeschön. Wow PR already up - you're fast!

@linkdotnet
Copy link
Collaborator

Sehr gern. We could release a pre-release if you want - depending on your policy.

@MorneZaayman
Copy link
Author

I appreciate it, but there's no need for that, as long as it won't be months before it is released. We have some other work to complete before this goes live anyway, so we can deal with the failing test in the meantime.

@linkdotnet
Copy link
Collaborator

No I don't think so - @egil It might make sense to release even that version as we patch the CVE in STJ as well.
Otherwise folks might have to do the same just because bUnit uses an old STJ version (due to its dependencies)

@egil
Copy link
Member

egil commented Jul 19, 2024

Let's do it @linkdotnet. Send a release out.

@linkdotnet
Copy link
Collaborator

Version 1.30 is out @MorneZaayman - This includes the new fix

@MorneZaayman
Copy link
Author

Thanks for the quick turnaround. Sorry for the delay in getting back to you - I was away on leave and then catching up when I returned. I've tested with the latest release and it's working perfectly 👍🏻.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants