解决发布测试bug

This commit is contained in:
runny committed 2026-05-30 14:42:33 +08:00
1 parent 7f66d6f20c
commit a148f76217
3 files changed
+23 -49

No files matched your search

+10 -4
View File
@@ -466,10 +466,16 @@ def _convert_excel_to_xlsx(content: bytes, ext: str) -> bytes:
stderr = process.stderr.decode('utf-8', errors='ignore').strip()
errors.append(f"{cmd}: {stderr or f'code={process.returncode}'}")
if _convert_excel_via_windows_office(input_path, output_path):
with open(output_path, 'rb') as f:
return f.read()
errors.append("windows-office: failed to convert xls via WPS/MS Excel")
allow_windows_excel_preview = (
os.getenv('ENABLE_WINDOWS_EXCEL_PREVIEW_CONVERSION', '').strip().lower() in ('1', 'true', 'yes', 'on')
)
if allow_windows_excel_preview:
if _convert_excel_via_windows_office(input_path, output_path):
with open(output_path, 'rb') as f:
return f.read()
errors.append("windows-office: failed to convert xls via WPS/MS Excel")
else:
errors.append("windows-office: disabled for preview to avoid interactive Office dialogs")
joined = "; ".join(errors) if errors else "no converter attempted"
raise RuntimeError(f"failed to convert xls to xlsx: {joined}")