From e52aefed3cc3386e1122e5d2da0d6555b3b3ae2a Mon Sep 17 00:00:00 2001 From: flavienbwk Date: Fri, 5 Aug 2022 12:49:12 +0200 Subject: [PATCH] Fixing wrong path format for Windows --- mkdocs_with_pdf/templates/filters/url.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mkdocs_with_pdf/templates/filters/url.py b/mkdocs_with_pdf/templates/filters/url.py index c7470e9d..909ea047 100644 --- a/mkdocs_with_pdf/templates/filters/url.py +++ b/mkdocs_with_pdf/templates/filters/url.py @@ -1,4 +1,5 @@ import os +import sys from urllib.parse import urlparse from . import _FilterBase @@ -29,7 +30,9 @@ def __call__(self, pathname: str) -> str: continue path = os.path.abspath(os.path.join(d, pathname)) if os.path.isfile(path): - return 'file://' + path + return 'file:///' + path.replace("\\", "/") \ + if sys.platform == 'win32' \ + else 'file://' + path # not found? return pathname