Properly encode UTF-8 in remora URLs (bug 559731)
This commit is contained in:
Родитель
2563e9c233
Коммит
194e970a91
|
@ -1,5 +1,6 @@
|
|||
import hashlib
|
||||
from time import time
|
||||
import urllib
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils import translation
|
||||
|
@ -55,4 +56,5 @@ def remora_url(context, url, lang=None, app=None, prefix=''):
|
|||
url_parts = [prefix, lang, app, url]
|
||||
url_parts = [p.strip('/') for p in url_parts if p]
|
||||
|
||||
return '/'+'/'.join(url_parts)
|
||||
full_path = '/'+'/'.join(url_parts)
|
||||
return urllib.quote(full_path.encode('utf-8'))
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
|
||||
from mock import Mock
|
||||
|
@ -138,3 +139,7 @@ class TestHelpers(TestCase):
|
|||
|
||||
url = remora_url(ctx, '/devhub/something', app='', prefix='remora')
|
||||
eq_(url, '/remora/en-US/devhub/something')
|
||||
|
||||
# UTF-8 strings
|
||||
url = remora_url(ctx, u'/tags/Hallo und tschüß')
|
||||
eq_(url, '/en-US/firefox/tags/Hallo%20und%20tsch%C3%BC%C3%9F')
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% macro tag_li(tag, addon=None, css_class='') -%}
|
||||
<li id="taglink-{{ tag.id }}" class="{{ css_class }}">
|
||||
<a href="{{ remora_url('/tag/') }}/{{ tag.tag_text }}" class="tagitem">
|
||||
<a href="{{ remora_url('/tag/'+tag.tag_text) }}" class="tagitem">
|
||||
{{ tag.tag_text }}
|
||||
</a>
|
||||
{% if is_tag_admin or tag.addon_tags.user == request.user or
|
||||
|
|
Загрузка…
Ссылка в новой задаче