File tree Expand file tree Collapse file tree 6 files changed +20
-0
lines changed
Expand file tree Collapse file tree 6 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 55* .mp3 filter =lfs diff =lfs merge =lfs - text
66* .mp4 filter =lfs diff =lfs merge =lfs - text
77* .wav filter =lfs diff =lfs merge =lfs - text
8+ * .svg filter =lfs diff =lfs merge =lfs - text
89* text =auto eol =lf
Original file line number Diff line number Diff line change @@ -1622,3 +1622,8 @@ The builder supports task lists with checkboxes:
16221622 - [ ] Another bullet point.
16231623
16241624 3. [ ] Task C
1625+
1626+ SVG support
1627+ ~~~~~~~~~~~
1628+
1629+ .. image :: _static/camera.svg
Original file line number Diff line number Diff line change 22checkboxes
33reStructuredText
44Schrödinger
5+ SVG
Original file line number Diff line number Diff line change 11CLI
2+ SVG
23backtick
34backticks
45callout
Original file line number Diff line number Diff line change 55
66import hashlib
77import json
8+ import mimetypes
89from enum import Enum
910from functools import cache
1011from pathlib import Path
@@ -150,10 +151,18 @@ def _block_from_details(
150151 # across Python versions and platforms.
151152 file_path = Path (url2pathname (parsed .path )) # type: ignore[misc]
152153
154+ # Ultimate Notion does not support SVG files, so we need to
155+ # provide the MIME type ourselves for SVG files.
156+ # See https://github.com/ultimate-notion/ultimate-notion/issues/141.
157+ mime_type , _ = mimetypes .guess_type (url = file_path .name )
158+ if mime_type != "image/svg+xml" :
159+ mime_type = None
160+
153161 with file_path .open (mode = "rb" ) as file_stream :
154162 uploaded_file = session .upload (
155163 file = file_stream ,
156164 file_name = file_path .name ,
165+ mime_type = mime_type ,
157166 )
158167
159168 uploaded_file .wait_until_uploaded ()
You can’t perform that action at this time.
0 commit comments