@budibase/worker
Version:
Budibase background service
10 lines (9 loc) • 319 B
text/typescript
/**
* Makes sure that a URL has the correct number of slashes, while maintaining the
* http(s):// double slashes.
* @param url The URL to test and remove any extra double slashes.
* @return The updated url.
*/
export function checkSlashesInUrl(url: string) {
return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2")
}