Search code examples
ruby-on-railsrubyurlurl-encoding

Rails-Api limits length of url


When sending a request to my rails app:

http://0.0.0.0:3334/v1/api/notebooks/users/verified/courses/None/files/asset-v1%3AedX%2BDemoX%2BDemo_Course%2Btype%40asset%2Bblock%40Welcome_R__-_demo.ipynb

I notice that params that rails passes to the controller are:

Parameters: {"username"=>"verified", "course"=>"None", "file"=>"asset-v1:edX+DemoX+Demo_Course+type@asset+block@Welcome_R__-_demo"}

It has removed the period, or .fileextension. I realise this is because rails seems to have some set maximum length for a url. Is there a way to get around this?


Solution

  • The last part of a URL is usually pulled out as params[:format]. You can avoid this by specifying your path as /*path, but usually putting the format parameter back on is not a big deal.