From 1050c26f8a2b0a8306f394c817146609076340d9 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 The first element of env.relfn2path() should be a OS dependent path, not a posix path. --- CHANGES | 2 ++ sphinx/environment/__init__.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) 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..20e76d826e6 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -10,7 +10,6 @@ import os import pickle -import posixpath import warnings from collections import defaultdict from copy import copy @@ -358,7 +357,7 @@ def relfn2path(self, filename: str, docname: str = None) -> Tuple[str, str]: base=None)) rel_fn = path.join(docdir, filename) - return (posixpath.normpath(rel_fn), + return (path.normpath(rel_fn), path.normpath(path.join(self.srcdir, rel_fn))) @property