1
0
Fork 0
mirror of synced 2024-10-02 18:16:29 +13:00
budibase/packages/worker/src/utilities/index.js

10 lines
327 B
JavaScript
Raw Normal View History

/**
* Makes sure that a URL has the correct number of slashes, while maintaining the
* http(s):// double slashes.
* @param {string} url The URL to test and remove any extra double slashes.
* @return {string} The updated url.
*/
2021-05-03 19:31:09 +12:00
exports.checkSlashesInUrl = (url) => {
return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2")
}