Skip to content

Commit

Permalink
str-cast paths for sphinx 6.1.x's guess_mimetype
Browse files Browse the repository at this point in the history
Sphinx's `guess_mimetype` for v6.1.x series requires a string type
value (i.e. not a path-like object). Adding an explicit cast while we
still support this version.

Signed-off-by: James Knight <james.d.knight@live.com>
  • Loading branch information
jdknight committed Feb 27, 2024
1 parent cdf6ac5 commit 6f4902d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sphinxcontrib/confluencebuilder/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ def _handle_entry(self, path, docname, standalone=False):

if path not in self.path2asset:
hash_ = ConfluenceUtil.hash_asset(path)
type_ = guess_mimetype(path, default=DEFAULT_CONTENT_TYPE)
# str-cast for sphinx-6.1
type_ = guess_mimetype(str(path), default=DEFAULT_CONTENT_TYPE)
else:
hash_ = self.path2asset[path].hash
type_ = self.path2asset[path].type
Expand Down
2 changes: 1 addition & 1 deletion sphinxcontrib/confluencebuilder/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def confluence_supported_svg(builder, node):
return

# ignore non-svgs
mimetype = guess_mimetype(abs_path)
mimetype = guess_mimetype(str(abs_path)) # cast for sphinx-6.1
if mimetype != 'image/svg+xml':
return

Expand Down

0 comments on commit 6f4902d

Please sign in to comment.