hydra-head icon indicating copy to clipboard operation
hydra-head copied to clipboard

Range request: NoMethodError (undefined method `split' for nil:NilClass)

Open bbpennel opened this issue 1 year ago • 0 comments

Descriptive summary

If a client makes a download request with the Range header but doesn't specify a byte range ("Range: bytes=" ), then the server returns a 500.

Rationale

The server should handle the range header gracefully rather than a server error page.

Expected behavior

I believe the expected behavior is to return the whole file and a 206 status, although i found conflicting information about whether it should instead return a 400. My guess is clients are checking if ranges are supported though, so responding with the whole file makes sense to me.

Actual behavior

Including the header triggers an error. See below.

Steps to reproduce the behavior

Make a request with the Range header like so (when nurax is functional): curl "https://dev.nurax.samvera.org/downloads/p8418n51k?locale=en" -i -H "Range: bytes="

You should get an error response with an error along the lines of:

NoMethodError (undefined method `split' for nil:NilClass):
  
hydra-core (12.1.0) app/controllers/concerns/hydra/controller/download_behavior.rb:98:in `send_range'
hydra-core (12.1.0) app/controllers/concerns/hydra/controller/download_behavior.rb:69:in `
hydra-core (12.1.0) app/controllers/concerns/hydra/controller/download_behavior.rb:16:in `show'
hyrax (6127e4878a83) app/controllers/hyrax/downloads_controller.rb:21:in `show'

bbpennel avatar Mar 05 '24 20:03 bbpennel