Do not normalize URL fragments

Fixes #1655
This commit is contained in:
Waylan Limberg
2018-10-12 21:39:54 -04:00
parent d49fd196b5
commit c882f7a0b3
3 changed files with 15 additions and 1 deletions

View File

@@ -54,6 +54,10 @@ your global navigation uses more than one level, things will likely be broken.
[Bootswatch 4.1]: https://getbootstrap.com/docs/4.1/getting-started/introduction/
[dropdowns]: https://getbootstrap.com/docs/4.1/components/navs/#pills-with-dropdowns
### Other Changes and Additions to Version 1.1
* Bugfix: Do not normalize URL fragments (#1655).
## Version 1.0.4 (2018-09-07)
* Bugfix: Ignore absolute links in Markdown (#1621).

View File

@@ -104,6 +104,11 @@ class UtilsTests(unittest.TestCase):
'style.css?v=20180308c',
'style.css?v=20180308c',
'../style.css?v=20180308c'
],
'#some_id': [
'#some_id',
'#some_id',
'#some_id'
]
}
@@ -160,6 +165,11 @@ class UtilsTests(unittest.TestCase):
'style.css?v=20180308c',
'../style.css?v=20180308c',
'../../style.css?v=20180308c'
],
'#some_id': [
'#some_id',
'#some_id',
'#some_id'
]
}

View File

@@ -243,7 +243,7 @@ def normalize_url(path, page=None, base=''):
path = path_to_url(path or '.')
# Allow links to be fully qualified URL's
parsed = urlparse(path)
if parsed.scheme or parsed.netloc or path.startswith('/'):
if parsed.scheme or parsed.netloc or path.startswith(('/', '#')):
return path
# We must be looking at a local path.