Merge pull request #5968 from ougfh/fix-doc-navigation-links-for-non-dir-urls
Do not add / for html pages in rewriteDocLinks
This commit is contained in:
@@ -82,6 +82,7 @@ describe('normalizeUrl', () => {
|
||||
['http://example.org/folder#intro', 'http://example.org/folder/#intro'],
|
||||
['http://example.org/folder/#intro', 'http://example.org/folder/#intro'],
|
||||
['http://example.org/folder#', 'http://example.org/folder/#'],
|
||||
['http://example.org/page.html', 'http://example.org/page.html'],
|
||||
])('should handle %s', (url, expected) => {
|
||||
expect(normalizeUrl(url)).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -58,7 +58,7 @@ export const rewriteDocLinks = (): Transformer => {
|
||||
export function normalizeUrl(input: string): string {
|
||||
const url = new URL(input);
|
||||
|
||||
if (!url.pathname.endsWith('/')) {
|
||||
if (!url.pathname.endsWith('/') && !url.pathname.endsWith('.html')) {
|
||||
url.pathname += '/';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user