fix: apply_matches сохраняет результат как .xlsx, а не .xlsm

openpyxl при wb.save() сбрасывает VBA-макросы из исходного .xlsm,
получая фактически .xlsx-контент под расширением .xlsm — Excel
такой файл не открывает. Меняем выходное расширение на .xlsx.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
anor
2026-05-06 16:59:23 +10:00
co-authored by Claude Opus 4.7
parent e2635df90b
commit 3543314cdf
+3 -1
View File
@@ -483,7 +483,9 @@ async def apply_matches_endpoint(request: Request):
fpath = work_dir / safe_name
if not fpath.exists():
raise HTTPException(404, "File not found in work directory")
out_name = f"{Path(safe_name).stem}_filled.xlsm"
# openpyxl drops VBA macros when saving — write as .xlsx so Excel
# opens it cleanly even when the source was .xlsm
out_name = f"{Path(safe_name).stem}_filled.xlsx"
out_path = work_dir / out_name
try:
result = apply_to_registry(fpath, out_path)