Keep original ZIP metadata immutable during guarded Atelier patch verification
This commit is contained in:
parent
8d5dd645a7
commit
c864dcc5b0
1 changed files with 2 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
"""Preserve the existing Atelier menus/quests; adapt only receipt metadata rendering."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import copy
|
||||
import os
|
||||
import sys
|
||||
import zipfile
|
||||
|
|
@ -30,7 +31,7 @@ def install(artifact, apply=False):
|
|||
try:
|
||||
with zipfile.ZipFile(temporary, 'w', zipfile.ZIP_DEFLATED) as output:
|
||||
for item in original.infolist():
|
||||
output.writestr(item, descriptor.encode() if item.filename == 'plugin.yml' else entries.get(item.filename, original.read(item.filename)))
|
||||
output.writestr(copy.copy(item), descriptor.encode() if item.filename == 'plugin.yml' else entries.get(item.filename, original.read(item.filename)))
|
||||
with zipfile.ZipFile(temporary) as check:
|
||||
assert check.testzip() is None
|
||||
assert all(check.read(name) == original.read(name) for name in original.namelist() if name not in CLASSES | {'plugin.yml'})
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff