Skip to content

Commit

Permalink
Fixed privacy plugin not handling URL-encoded pathnames
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Feb 24, 2024
1 parent 10a97aa commit ca7e952
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions material/plugins/privacy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from mkdocs.structure.files import File, Files
from mkdocs.utils import is_error_template
from re import Match
from urllib.parse import ParseResult as URL, urlparse
from urllib.parse import ParseResult as URL, urlparse, unquote
from xml.etree.ElementTree import Element, tostring

from .config import PrivacyConfig
Expand Down Expand Up @@ -515,7 +515,7 @@ def _path_from_url(self, url: URL):
# Create a file for the given path
def _path_to_file(self, path: str, config: MkDocsConfig):
return File(
posixpath.join(self.config.assets_fetch_dir, path),
posixpath.join(self.config.assets_fetch_dir, unquote(path)),
os.path.abspath(self.config.cache_dir),
config.site_dir,
False
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/privacy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from mkdocs.structure.files import File, Files
from mkdocs.utils import is_error_template
from re import Match
from urllib.parse import ParseResult as URL, urlparse
from urllib.parse import ParseResult as URL, urlparse, unquote
from xml.etree.ElementTree import Element, tostring

from .config import PrivacyConfig
Expand Down Expand Up @@ -515,7 +515,7 @@ def _path_from_url(self, url: URL):
# Create a file for the given path
def _path_to_file(self, path: str, config: MkDocsConfig):
return File(
posixpath.join(self.config.assets_fetch_dir, path),
posixpath.join(self.config.assets_fetch_dir, unquote(path)),
os.path.abspath(self.config.cache_dir),
config.site_dir,
False
Expand Down

0 comments on commit ca7e952

Please sign in to comment.