Skip to content

Commit ca7e952

Browse files
committed
Fixed privacy plugin not handling URL-encoded pathnames
1 parent 10a97aa commit ca7e952

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: material/plugins/privacy/plugin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from mkdocs.structure.files import File, Files
3838
from mkdocs.utils import is_error_template
3939
from re import Match
40-
from urllib.parse import ParseResult as URL, urlparse
40+
from urllib.parse import ParseResult as URL, urlparse, unquote
4141
from xml.etree.ElementTree import Element, tostring
4242

4343
from .config import PrivacyConfig
@@ -515,7 +515,7 @@ def _path_from_url(self, url: URL):
515515
# Create a file for the given path
516516
def _path_to_file(self, path: str, config: MkDocsConfig):
517517
return File(
518-
posixpath.join(self.config.assets_fetch_dir, path),
518+
posixpath.join(self.config.assets_fetch_dir, unquote(path)),
519519
os.path.abspath(self.config.cache_dir),
520520
config.site_dir,
521521
False

Diff for: src/plugins/privacy/plugin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from mkdocs.structure.files import File, Files
3838
from mkdocs.utils import is_error_template
3939
from re import Match
40-
from urllib.parse import ParseResult as URL, urlparse
40+
from urllib.parse import ParseResult as URL, urlparse, unquote
4141
from xml.etree.ElementTree import Element, tostring
4242

4343
from .config import PrivacyConfig
@@ -515,7 +515,7 @@ def _path_from_url(self, url: URL):
515515
# Create a file for the given path
516516
def _path_to_file(self, path: str, config: MkDocsConfig):
517517
return File(
518-
posixpath.join(self.config.assets_fetch_dir, path),
518+
posixpath.join(self.config.assets_fetch_dir, unquote(path)),
519519
os.path.abspath(self.config.cache_dir),
520520
config.site_dir,
521521
False

0 commit comments

Comments
 (0)