2021-04-22 18:57:38 +02:00
|
|
|
/**
|
|
|
|
* Makes sure that a URL has the correct number of slashes, while maintaining the
|
|
|
|
* http(s):// double slashes.
|
2023-10-17 17:46:32 +02:00
|
|
|
* @param url The URL to test and remove any extra double slashes.
|
|
|
|
* @return The updated url.
|
2021-04-22 18:57:38 +02:00
|
|
|
*/
|
2022-11-23 19:25:20 +01:00
|
|
|
export function checkSlashesInUrl(url: string) {
|
2021-04-22 18:57:38 +02:00
|
|
|
return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2")
|
|
|
|
}
|