Keep a multi-range upload response's multipart type

A request for several byte ranges gets a 206 multipart/byteranges whose
boundary the client needs to split the body. Rewriting it to
octet-stream lost the boundary. No browser runs that type as a script,
so it passes through.
This commit is contained in:
Jeremy Daer committed 2026-10-15 19:01:12 -07:00
1 parent d713f2631d
commit 9c37f41ff6
2 files changed
+9 -2

No files matched your search

@@ -21,6 +21,11 @@ class UploadedScriptGuardTest < ActiveSupport::TestCase
end
end
test "multi-range responses keep their boundary" do
type = "multipart/byteranges; boundary=AaB03x"
assert_equal type, served_type(type, "#{ActiveStorage.routes_prefix}/blobs/proxy/key/movie.mp4")
end
test "direct upload responses keep their JSON type" do
assert_equal "application/json", served_type("application/json", "#{ActiveStorage.routes_prefix}/direct_uploads", method: "POST")
end