Skip to content

Commit 6868c81

Browse files
anoadragon453richvdh
authored andcommitted
Write font files as binary instead of text (#3039)
This caused the font files to be corrupt and rejected by the browser's sanitising engine.
1 parent dc26289 commit 6868c81

22 files changed

+2
-2
lines changed

static/css/fonts/download_google_fonts_css.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@
100100
font_family, font_lang, font_style, font_weight
101101
)
102102
font_filepath = font_output_dir + filename
103-
with open(font_filepath, "w") as f:
103+
with open(font_filepath, "wb") as f:
104104
print("Writing font file:", font_filepath)
105-
f.write(resp.text)
105+
f.write(resp.content)
106106

107107
# Replace google URL with local URL
108108
line = re.sub(r"url\(.+\)", f"url({css_font_path + filename})", line)
-8.25 KB
Binary file not shown.
-7.67 KB
Binary file not shown.
-8.41 KB
Binary file not shown.
-5.25 KB
Binary file not shown.
-4.99 KB
Binary file not shown.
-5.37 KB
Binary file not shown.
-4.18 KB
Binary file not shown.
-3.81 KB
Binary file not shown.
-4.24 KB
Binary file not shown.

0 commit comments

Comments
 (0)