Commit cba58f9
committed
fix: return None if remote image length is unavailable
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: #353
Signed-off-by: Luke Hsiao <[email protected]>1 parent 257186d commit cba58f9
1 file changed
+12
-7
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 | | |
| |||
588 | 587 | | |
589 | 588 | | |
590 | 589 | | |
591 | | - | |
592 | | - | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
593 | 595 | | |
594 | 596 | | |
595 | 597 | | |
596 | | - | |
597 | | - | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
598 | 603 | | |
599 | 604 | | |
600 | 605 | | |
| |||
707 | 712 | | |
708 | 713 | | |
709 | 714 | | |
710 | | - | |
| 715 | + | |
711 | 716 | | |
712 | 717 | | |
713 | 718 | | |
| |||
0 commit comments