elixir - Keep @ character unescaped -
i have following route:
get "/@:user_name", usercontroller, :show
which appears work. however, when use url helper:
user_path( @conn, :show, @current_user.user_name )
the output escaped:
if implement route this:
get "/@/:user_name", usercontroller, :show
then @ symbol outputted un-escaped:
is there way implement first route without escaping @ symbol? using @ symbol in url path bad idea?
the reason phoenix helper expands segments , encodes params. last segment in http://url.com/@user
considered being param, while in http://url.com/@/user
not.
there might different opinions on correct way, or not, truth param (user name in particular case) typically coming outside world, while route comes code. that’s why http://url.com/@/user
not uri.encode
d.
i not fight against how phoenix handles , go http://url.com/@/user
or like.
otoh, https://url.com/%40user
, https://url.com/@user
same point of view of browser , lead same destination.
hope helps.
Comments
Post a Comment