2021-12-10 16:10:45 +01: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-12-10 16:10:45 +01:00
|
|
|
*/
|
2022-11-24 19:48:51 +01:00
|
|
|
export function checkSlashesInUrl(url: string) {
|
2021-12-10 16:10:45 +01:00
|
|
|
return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2")
|
|
|
|
}
|