use absolute urls for files (bug 609187)
This commit is contained in:
Родитель
8196f5ef13
Коммит
e8aa05bef0
|
@ -228,6 +228,13 @@ class APITest(TestCase):
|
|||
response = make_call('addon/4664', version=1.5)
|
||||
self.assertNotContains(response, settings.SITE_URL + settings.SITE_URL)
|
||||
|
||||
def test_absolute_install_url(self):
|
||||
response = make_call('addon/4664', version=1.2)
|
||||
doc = pq(response.content)
|
||||
url = doc('install').text()
|
||||
expected = '%s/firefox/downloads/file' % settings.SITE_URL
|
||||
assert url.startswith(expected), url
|
||||
|
||||
def test_15_addon_detail(self):
|
||||
"""
|
||||
For an api>1.5 we need to verify we have:
|
||||
|
|
|
@ -34,9 +34,10 @@ class File(amo.models.ModelBase):
|
|||
|
||||
def get_url_path(self, app, src):
|
||||
# TODO: remove app
|
||||
from amo.helpers import urlparams
|
||||
from amo.helpers import urlparams, absolutify
|
||||
url = reverse('downloads.file', args=[self.id]) + self.filename
|
||||
return urlparams(url, src=src)
|
||||
# Firefox's Add-on Manager needs absolute urls.
|
||||
return absolutify(urlparams(url, src=src))
|
||||
|
||||
def generate_filename(self, extension='xpi'):
|
||||
"""
|
||||
|
|
Загрузка…
Ссылка в новой задаче