mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
fix isGoogleUrl (#1871)
This commit is contained in:
parent
b2fa5dc538
commit
5d3de435ae
@ -1,3 +1,5 @@
|
||||
import isUrl from 'is-url-superb'
|
||||
|
||||
export function sanitizeUrl(url: string) {
|
||||
const u = decodeURI(url).trim().toLowerCase()
|
||||
const isAllowedUrlScheme = u.startsWith('http://') || u.startsWith('https://')
|
||||
@ -6,7 +8,7 @@ export function sanitizeUrl(url: string) {
|
||||
|
||||
// check if the url is a google domain
|
||||
export const isGoogleUrl = (url: string): boolean => {
|
||||
if (!url) return
|
||||
if (!url || !isUrl(url)) return
|
||||
const googleUrl = new URL(url)
|
||||
return googleUrl.hostname.endsWith('google.com')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user