fix: ensure well formed URLs for IP address destinations

This commit is contained in:
Carlos Valente
2025-10-18 11:01:17 +02:00
committed by Carlos Valente
parent cbc03c898c
commit e488ad19b3
4 changed files with 26 additions and 3 deletions
@@ -62,6 +62,11 @@ export function generateShareUrl(
canonicalPath: string,
{ authenticate, lockConfig, lockNav, preset, prefix = routerPrefix, hash = hashedPassword }: LinkOptions,
): URL {
/**
* URL constructor will throw if given an IP address without protocol
* for the case of IP addresses, we expect that the base URL provides protocol and port
* eg: http://192.168.10.1:4001
*/
const url = new URL(baseUrl);
// companion links point to the root