From 1e1c86aa16eb01269c622f9efd97516913eb63ed Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 7 Mar 2021 00:30:43 +0900 Subject: [PATCH] Fix #8959: using UNIX path separator confuses Sphinx on Windows --- CHANGES | 2 ++ sphinx/environment/__init__.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 8fa86a98b26..fe9e8e28bca 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,8 @@ Deprecated Features added -------------- +* #8959: using UNIX path separator in image directive confuses Sphinx on Windows + Bugs fixed ---------- diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index af3e2b8d542..6058b541fd2 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -34,6 +34,7 @@ from sphinx.util.docutils import LoggingReporter from sphinx.util.i18n import CatalogRepository, docname_to_domain from sphinx.util.nodes import is_translatable +from sphinx.util.osutil import os_path if False: # For type annotation @@ -351,6 +352,7 @@ def relfn2path(self, filename: str, docname: str = None) -> Tuple[str, str]: source dir, while relative filenames are relative to the dir of the containing document. """ + filename = os_path(filename) if filename.startswith('/') or filename.startswith(os.sep): rel_fn = filename[1:] else: