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:

https://url.com/%40user

if implement route this:

get "/@/:user_name", usercontroller, :show 

then @ symbol outputted un-escaped:

https://url.com/@/user

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.encoded.

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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -