Skip to content

Conversation

@lukehsiao
Copy link
Contributor

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

lukehsiao added 2 commits May 29, 2025 10:17
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]>
@sonarqubecloud
Copy link

@Guts Guts added the bug Something isn't working label May 30, 2025
@codecov
Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.73%. Comparing base (257186d) to head (6ce8a00).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #370   +/-   ##
=======================================
  Coverage   81.73%   81.73%           
=======================================
  Files          11       11           
  Lines         750      750           
  Branches      124      124           
=======================================
  Hits          613      613           
  Misses         95       95           
  Partials       42       42           
Flag Coverage Δ
unittests 81.73% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
mkdocs_rss_plugin/util.py 74.72% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@Guts Guts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @lukehsiao

@Guts Guts merged commit 0819fc2 into Guts:main May 30, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deployment failed after upgrading to 1.17.2 argument must be a string exception

2 participants