Skip to content

Commit 1f61e2e

Browse files
authored
Merge pull request #3 from LeafCreeper/copilot/fix-export-pdf-issue
Fix PDF export: MIME encoding for CJK filenames + apt cache in workflow
2 parents f4110be + 7b134d3 commit 1f61e2e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

.github/workflows/export.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- name: Install PDF dependencies
3636
if: inputs.export_pdf == true
3737
run: |
38+
sudo apt-get update
3839
sudo apt-get install -y fonts-noto-cjk libpango-1.0-0 libcairo2
3940
pip install weasyprint
4041

scripts/export_course.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ def _send_pdf_email(subject: str, pdf_bytes: bytes, filename: str) -> None:
9797
msg["From"] = formataddr(("iCourse Subscriber", config.SMTP_EMAIL))
9898
msg["To"] = config.RECEIVER_EMAIL
9999

100-
part = MIMEBase("application", "pdf")
100+
part = MIMEBase("application", "pdf", name=filename)
101101
part.set_payload(pdf_bytes)
102102
encoders.encode_base64(part)
103-
part.add_header("Content-Disposition", f'attachment; filename="{filename}"')
103+
part.add_header("Content-Disposition", "attachment", filename=filename)
104104
msg.attach(part)
105105

106106
with _smtp_connect() as server:

0 commit comments

Comments
 (0)