Commit 0819fc2
authored
fix: return None if remote image length is unavailable (#370)
When this plugin is run on a doc site that also uses the social plugin,
fetching remote image data can fail. This results in a crash when
building the documentation:
File
"/path/installs/python/3.11.5/lib/python3.11/site-packages/mkdocs_rss_plugin/util.py",
line 608, in get_image
img_length = self.get_remote_image_length(image_url=img_url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/path/installs/python/3.11.5/lib/python3.11/site-packages/mkdocs_rss_plugin/util.py",
line 710, in get_remote_image_length
return int(img_length)
^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a
real number, not 'NoneType'
This patch simply returns None if `img_length` is `None.`
Closes: #369
Closes: #3531 file changed
+2
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
| 129 | + | |
131 | 130 | | |
132 | 131 | | |
133 | 132 | | |
| |||
707 | 706 | | |
708 | 707 | | |
709 | 708 | | |
710 | | - | |
| 709 | + | |
711 | 710 | | |
712 | 711 | | |
713 | 712 | | |
| |||
0 commit comments