Skip to content

Commit ff93689

Browse files
authored
Rollbacking lowercasing paths since it breaks share links... (#271)
1 parent d8ffa5d commit ff93689

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/lib/middleware.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ describe('normalizeURL', () => {
118118
);
119119
});
120120

121-
it('should convert uppercase characters in the path to lowercase', () => {
122-
expect(normalizeURL(new URL('https://docs.mycompany.com/Hello/My/pAge'))).toEqual(
123-
new URL('https://docs.mycompany.com/hello/my/page'),
124-
);
125-
});
121+
// it('should convert uppercase characters in the path to lowercase', () => {
122+
// expect(normalizeURL(new URL('https://docs.mycompany.com/Hello/My/pAge'))).toEqual(
123+
// new URL('https://docs.mycompany.com/hello/my/page'),
124+
// );
125+
// });
126126

127-
it('should not affect uppercase characters in querystring parameters', () => {
128-
expect(normalizeURL(new URL('https://docs.mycompany.com/Hello/My/pAge?Q=MySearch'))).toEqual(
129-
new URL('https://docs.mycompany.com/hello/my/page?Q=MySearch'),
130-
);
131-
});
127+
// it('should not affect uppercase characters in querystring parameters', () => {
128+
// expect(normalizeURL(new URL('https://docs.mycompany.com/Hello/My/pAge?Q=MySearch'))).toEqual(
129+
// new URL('https://docs.mycompany.com/hello/my/page?Q=MySearch'),
130+
// );
131+
// });
132132
})

src/lib/middleware.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export function getURLLookupAlternatives(input: URL) {
9494
*/
9595
export function normalizeURL(url: URL) {
9696
const result = new URL(url);
97-
result.pathname = url.pathname.replace(/\/{2,}/g, '/').replace(/\/$/, '').toLowerCase();
97+
// TODO fix lowercasing only the pathname without share links...
98+
result.pathname = url.pathname.replace(/\/{2,}/g, '/').replace(/\/$/, ''); // .toLowerCase();
9899
return result;
99100
}

0 commit comments

Comments
 (0)