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

  1. Send a blob preview request without a content parameter or with a non-string content value.
  2. Verify that the request returns a 400 Bad Request response.
  3. Send a blob preview request with an empty string as content.
  4. 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.

Merge request reports

Loading
Loading