开发者

Escaping dots and backslashes in URL

开发者 https://www.devze.com 2023-02-04 00:58 出处:网络
I develop a small rails app. It has a controller books. Route /books/:title shows a book with specified tit开发者_运维技巧le.

I develop a small rails app. It has a controller books. Route /books/:title shows a book with specified tit开发者_运维技巧le.

The problem is that if book contains dots . or backslashes /, application returns either error Record not found, or routing error.

How to escape these characters, so that application can show such books correctly?


Well, I have found a solution. I added a route to include query strings for show action:

match '/show', :controller => 'books', :action => 'show'

It fixed my problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消