Keep original ZIP metadata immutable during guarded Atelier patch verification

This commit is contained in:
unimatrixgit 2026-11-16 03:36:50 +01:00
commit c864dcc5b0

View file

@ -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'})