From ff131b89660c54eddfb4fe21eada083ca467999d Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Mon, 3 Jul 2023 22:49:18 -0500 Subject: [PATCH] Fix source of backslashes in URLs --- nikola/nikola.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nikola/nikola.py b/nikola/nikola.py index 48aa8cef42..582090f3e9 100644 --- a/nikola/nikola.py +++ b/nikola/nikola.py @@ -33,6 +33,7 @@ import logging import operator import os +import pathlib import sys import mimetypes from collections import defaultdict @@ -1926,7 +1927,8 @@ def path(self, kind, name, lang=None, is_link=False, **kwargs): else: return link else: - return os.path.join(*path) + # URLs should always use forward slash separators, even on Windows + return pathlib.PurePosixPath(*path) def post_path(self, name, lang): """Link to the destination of an element in the POSTS/PAGES settings.