-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -496,6 +496,33 @@ def watermark(self, user): | |
|
||
return dest | ||
|
||
def inject_ids(self): | ||
""" | ||
For packaged webapps, adds a META-INF/ids.json file with a JSON | ||
document like the following: | ||
{"app_id": "6106d3b3-881a-4ddf-9dec-6b2bf8ff8341", | ||
"version_id": 42} | ||
""" | ||
app = self.version.addon | ||
if not (app.type == amo.ADDON_WEBAPP and app.is_packaged): | ||
return | ||
|
||
filename = 'META-INF/ids.json' | ||
ids = { | ||
'app_id': app.guid, | ||
'version_id': self.version_id, | ||
} | ||
zf = SafeUnzip(self.file_path, mode='a') | ||
zf.is_valid() | ||
|
||
# Check if there's already a META-INF/ids.json. | ||
if filename in [zi.filename for zi in zf.zip.filelist]: | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
robhudson
Author
Member
|
||
zf.zip.close() | ||
This comment has been minimized.
Sorry, something went wrong.
andymckay
Contributor
|
||
return | ||
|
||
zf.zip.writestr('META-INF/ids.json', json.dumps(ids)) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
zf.zip.close() | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
|
||
@receiver(models.signals.post_save, sender=File, | ||
dispatch_uid='cache_localpicker') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,9 @@ def from_upload(cls, upload, addon, platforms, send_signal=True): | |
platforms = cls._make_safe_platform_files(platforms) | ||
|
||
for platform in platforms: | ||
File.from_upload(upload, v, platform, parse_data=data) | ||
f = File.from_upload(upload, v, platform, parse_data=data) | ||
if addon.type == amo.ADDON_WEBAPP and addon.is_packaged: | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
robhudson
Author
Member
|
||
f.inject_ids() | ||
|
||
v.disable_old_files() | ||
# After the upload has been copied to all platforms, remove the upload. | ||
|
I thought you could access the file directly with
zf.zip.getinfo(filename)