diff --git a/app/controllers/tracks_controller.rb b/app/controllers/tracks_controller.rb index a54184b3..945ee087 100644 --- a/app/controllers/tracks_controller.rb +++ b/app/controllers/tracks_controller.rb @@ -116,6 +116,10 @@ def audio_with_stream(stream, mimetype, total_size) response.content_type = mimetype response.headers['accept-ranges'] = 'bytes' response.headers['content-length'] = (last_byte - first_byte + 1).to_s + # Unfortunately, if we don't commit the headers, ActionController::Live will + # delete the "content-length" header set above. No other headers need to be + # set, so we just freeze them here. + response.commit! to_skip = first_byte while to_skip.positive?