twig - Symfony 2.1+ encodes hash/pound "#" in routes -


i'm in process of upgrading symfony 2.0 2.3. have routes hashes defined since have single page app.

a route configured via annotations:

/**  * @route("/app#orders/{id}", name="app_order")  */ 

we use twig generate emails , use these routes within twig templates:

<a href="{{ url('app_order', { 'id': '123' }) }}">view order</a> 

before upgrading, worked fine. after upgrade, # gets encoded %23 slashes remain intact. of course generates invalid url in email.

why hashes encoding , not slashes? should or nothing. options have here other doing string replace?

things i've tried doing don't help:

  • setting autoescape false {% autoescape false %}
  • using raw {{ url(...)|raw }}
  • using raw , autoescape=false in conjunction

if take @ urlgenerator code, can see, hashtag not decoded after rawurlencode. escaping of hashtag added in commit 6039569.

as workaround extend urlgenerator class , replace $decodedchars array hashtag included. tell symfony use generator class:

parameters:     router.options.generator_base_class: acme\mybundle\routing\hashtagdecodedurlgenerator 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -