From 6f4902db534b920fb625acb61ce2b787e8bd2837 Mon Sep 17 00:00:00 2001 From: James Knight Date: Mon, 26 Feb 2024 21:45:46 -0500 Subject: [PATCH] str-cast paths for sphinx 6.1.x's guess_mimetype 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 --- sphinxcontrib/confluencebuilder/assets.py | 3 ++- sphinxcontrib/confluencebuilder/svg.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sphinxcontrib/confluencebuilder/assets.py b/sphinxcontrib/confluencebuilder/assets.py index 53671fc0..4ba3307d 100644 --- a/sphinxcontrib/confluencebuilder/assets.py +++ b/sphinxcontrib/confluencebuilder/assets.py @@ -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 diff --git a/sphinxcontrib/confluencebuilder/svg.py b/sphinxcontrib/confluencebuilder/svg.py index 0d5cfbc1..4f3e28b7 100644 --- a/sphinxcontrib/confluencebuilder/svg.py +++ b/sphinxcontrib/confluencebuilder/svg.py @@ -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