Fix update_link with new directory structure in update service (#19244)
This commit is contained in:
Родитель
2621223701
Коммит
2be5c1f145
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
import logging.config
|
||||
import os
|
||||
|
||||
from django.utils.encoding import force_bytes
|
||||
from email.utils import formatdate
|
||||
|
@ -197,7 +198,7 @@ class Update:
|
|||
slug = data['slug']
|
||||
version = data['version']
|
||||
file_id = data['file_id']
|
||||
filename = data['filename']
|
||||
filename = os.path.basename(data['filename'])
|
||||
update = {
|
||||
'version': data['version'],
|
||||
# This is essentially re-implementing File.get_absolute_url()
|
||||
|
|
|
@ -451,6 +451,13 @@ class TestResponse(VersionCheckMixin, TestCase):
|
|||
guid = '{2fa4ed95-0317-4c6a-a74c-5f3e3912c1f9}'
|
||||
assert data['addons'][guid]['updates'][0]['update_link'] == self.get_file_url()
|
||||
|
||||
def test_url_new_directory_structure(self):
|
||||
File.objects.filter(pk=self.addon.current_version.file.pk).update(
|
||||
file='67/4567/1234567/addon-1.0.xpi'
|
||||
)
|
||||
self.addon.current_version.file.reload()
|
||||
self.test_url()
|
||||
|
||||
def test_url_local_recent(self):
|
||||
a_bit_ago = datetime.now() - timedelta(seconds=60)
|
||||
File.objects.get(pk=67442).update(datestatuschanged=a_bit_ago)
|
||||
|
|
Загрузка…
Ссылка в новой задаче