Instantly share code, notes, and snippets.
CreatedDecember 17, 2025 16:23
Save trycf/e9acda7c21e4393a90df69e8afadc390 to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| <cfscript> | |
| getBaseUrl= (stringurlString="" )=> { | |
| if (len(arguments.urlString ) ) { | |
| varurlParts=arguments.urlString.trim().listToArray("/" ); | |
| if(urlParts.len()>=2&&arrayFindNoCase( ["https:","http:"],urlParts[1] ) ) | |
| returnurlParts[1]&"//"&urlParts[2]&"/"; | |
| } | |
| return""; | |
| } | |
| [ | |
| "", | |
| "", | |
| "http://google.com", | |
| "google.com", | |
| "https://localhost", | |
| "https://google.com/index.html", | |
| "https://centraladmin-sreqaohweb02.silkroad-eng.com/devutilities/sso/?company_id=3052", | |
| "http://sso.fbports.com/Default.aspx", | |
| "http://wsncohd013/bobby/ssoAuthServer/index.cfm", | |
| "https://azusapacificuniversity-lsauth.silkroad.com/Default.aspx?referer=https://apu-staging-openhire.silkroad.com/index.cfm?fuseaction=authentication.login", | |
| "https://autokiniton-test-redcarpet.silkroad.com/Authentication?referer=https://towerinternational-staging-openhire.silkroad.com/index.cfm%3Ffuseaction=authentication.login", | |
| "https://MSGCU-Staging-redcarpet.silkroad.com/Authentication?referer=https://MSGCU-Staging-openhire.silkroad.com/index.cfm?fuseaction=authentication.login" | |
| ].each( (_url )=>dump(getBaseUrl(_url ) ) ) | |
| </cfscript> |
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment