mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
feat(server): create unit tests for normalizing server URL, and fix logic based on feedback
This commit is contained in:
@@ -394,14 +394,14 @@ export function normalizeUrl(url: string): string {
|
||||
return url;
|
||||
}
|
||||
|
||||
// Fix double slashes (except in protocol) first
|
||||
url = url.replace(/([^:]\/)\/+/g, '$1');
|
||||
|
||||
// Remove trailing slash, but preserve protocol
|
||||
if (url.endsWith('/') && !url.match(/^https?:\/\/$/)) {
|
||||
url = url.slice(0, -1);
|
||||
}
|
||||
|
||||
// Fix double slashes (except in protocol)
|
||||
url = url.replace(/([^:]\/)\/+/g, '$1');
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user