Loading
Return bad request for invalid blob preview content
What does this MR do and why?
Problem
Missing or non-scalar content parameters cause #preview to raise
NoMethodError when the preview size check calls bytesize. This turns
malformed preview requests into 500 responses instead of 400 responses.
Solution
- Reject preview content unless it is a string.
- Preserve empty-string content for empty-file previews.
- Add request specs for missing, non-string, and empty content.
References
No related issues.
Screenshots or screen recordings
Not applicable; this change has no visual impact.
How to set up and validate locally
- Send a blob preview request without a
contentparameter or with a non-stringcontentvalue. - Verify that the request returns a
400 Bad Requestresponse. - Send a blob preview request with an empty string as
content. - Verify that the empty-file preview renders successfully.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.