I'm just developing a WebDAV interface for a Rails App. Therefor I'm routing all webdav.example.com/path/to/folder paths to a webdav controller:
scope controller: 'webdav', constraints: {subdomain: 'webdav'} do
get '*path', action: 'show'
# some more webdav specific routes...
end
Everything works fine, but for a folder called 'Verträge' the native Windows client now requests webdav.example.com/Vertr%E4ge which unfortunately breaks the rails routing process raising an ActionController::BadRequest...
After some research I figured out that i.e. Gems like HighVoltage have the same problem.
Does anybody has an idea to solve this? Regardless of telling Windows to send a real 'ä' or fixing it at rails side...
UPDATE:
%E4 belongs to ISO-8859-1 (ISO Latin 1) Character Encoding, but Rails routing works with UTF-8.
So GET webdav.example.com/Vertr%C3%A4ge works perfectly fine.
How do I get either Windows to UTF8 encode the urls or Rails to recognize and convert the urls properly before dispatching the request?
Currently ended up patching ActionDispatch::Routing::RouteSet::Dispatcher this way: https://gist.github.com/sdhull/9240273
Other solutions / discussions are welcome :)
Related
dear all of master in rails
I am new in developing web app using rails.
Now, i want to try create an app rails using web socket.
I get good tutorial from here
However, when i improve my experience in rails. I get conflict between url websocket and url created in routes.rb
in my routes.rb
get ':username' => 'users#profile', as:"profile"
the url get conflict with url web socket and then, my web app websocket getting failure.
anyone could help me to solve my problem..???
thanks
I fixed this using a routing constraint:
get '/:hash', to: 'conversations#show', constraints: {hash: /((?!websocket).)*/}
The route will not work unless the :hash does not contain the string "websocket"
I'm sure there's a better regex out there, and if my hash ever randomly contains the string "websocket" it'll fail.
But, this fixes your problem for me in development.
What is the error exactly?
You need to change the route
get '/username' => 'users#profile', as:"profile"
I think your should read this
Are those changes major or minor? I'm concerned mostyl because gems for translating routing stopped working (rails-translate-routes - problem with helpers generating paths) and i'm looking for some way to repair it
There are some details about routing changes here Looks like the main changes are the move to the PATCH verb, raising on conflicting named routes, and direct drawing of unicode routes. The first could be significant if you're specifying the PUT verb in your routes or in custom forms in your code. The others are fairly minor for most applications I would guess.
I used this gem and it's doing fine
I recently upgraded a site from Ruby 1.8.7 to Ruby 1.9.2, and from Rails 3.0.x to 3.2.x. I noticed that some of my legacy urls weren't being handled correctly anymore, and wanted to diagnose the issue.
Here's what I noticed.
http://myapp.com/links/oldlink.html had, in my old app, provided a params[:path] of /links/oldlink.html, but now is providing links/oldlink. So it's dropping the leading forwardslash as well as the file extension.
Can anyone help me figure out what's going on here? Of course I can manually change the legacy strings in my database to also drop their forward slashes and file extensions, but that seems like a hacky solution, and I want to make sure I understand the underlying principles that account for this change in the Rails routing behavior.
Thanks!
You should try this in your routes.rb
match '/foo', :to => redirect('/foo.html')
The company that hosts my website did an upgrade on the weekend and now all my ROR apps are coming up with this :
Routing Error
No route matches "/geotest/" with {:method=>:get}
These were working before and do work on my development system, but there has been no response to my ticket to their tech support. Anyone got a suggestion how I could fix this?
Maybe they upgraded to Rails 3 ? Your route should work anyway, but try to add this to your routes.rb file :
get '/geotest' => 'your_controller_name#index'
Change your_controller_name accordingly, of course.
Did the rules for Rails Routes changes from Rails 1.2.3 to Rails 2.2.3? I recently upgraded an application and instead of redirecting to the correct page, it now redirects to the main page (or Route page) for that matter.
The only thing that I can think of is that the routing rules changed in Rails 2.2.3.
Thanks
Yep there were a lot of changes as you can see here (look at the Action Pack Resources section) "This is where the bulk of the action for 2.0 has gone". If you're using the old semi-colon syntax then that could well be the problem. Do you want to post your route config and a quick description of what is not working?
Also, to diagnose routing problems I find running "rake routes" very useful (though set your terminal window to wide).
Chris