Symfony 2.1+ encodes hash/pound “#” in routes

前端 未结 1 1313
野性不改
野性不改 2020-12-19 14:28

I\'m in the process of upgrading from Symfony 2.0 to 2.3. We have routes with hashes defined since we have a single page app.

A route configured via annotations:

相关标签:
1条回答
  • 2020-12-19 15:18

    If you take a look at the UrlGenerator code, you can see, the hashtag is not decoded after rawurlencode. The escaping of the hashtag was added in commit 6039569.

    As a workaround you could extend the UrlGenerator class and replace the $decodedChars array with hashtag included. Then tell Symfony to use your generator class:

    parameters:
        router.options.generator_base_class: Acme\MyBundle\Routing\HashtagDecodedUrlGenerator
    
    0 讨论(0)
提交回复
热议问题