diff --git a/apps/addons/models.py b/apps/addons/models.py index 3c7f76663a..6783fa02a6 100644 --- a/apps/addons/models.py +++ b/apps/addons/models.py @@ -355,6 +355,8 @@ class Addon(amo.models.OnChangeMixin, amo.models.ModelBase): addon = Addon(**dict((k, v) for k, v in data.items() if k in fields)) addon.status = amo.STATUS_NULL addon.default_locale = to_language(translation.get_language()) + if addon.is_webapp(): + addon.manifest_url = upload.name addon.save() Version.from_upload(upload, addon, platforms) amo.log(amo.LOG.CREATE_ADDON, addon) diff --git a/apps/addons/tests/test_models.py b/apps/addons/tests/test_models.py index 461dd701fe..aa02a572b0 100644 --- a/apps/addons/tests/test_models.py +++ b/apps/addons/tests/test_models.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -from datetime import datetime, timedelta import itertools +import os +from datetime import datetime, timedelta from urlparse import urlparse from django import forms @@ -1322,6 +1323,14 @@ class TestAddonFromUpload(UploadTest): eq_(addon.description, None) eq_(addon.slug, 'xpi-name') + def test_manifest_url(self): + path = os.path.join(settings.ROOT, + 'apps/devhub/tests/addons/mozball.webapp') + upload = self.get_upload(abspath=path) + addon = Addon.from_upload(upload, [self.platform]) + assert addon.is_webapp() + eq_(addon.manifest_url, upload.name) + def test_xpi_version(self): addon = Addon.from_upload(self.get_upload('extension.xpi'), [self.platform])