This commit is contained in:
parent
3125032e82
commit
9d7996d7fd
@ -506,6 +506,12 @@ class SyncplayClient(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def isURITrusted(self, URIToTest):
|
def isURITrusted(self, URIToTest):
|
||||||
|
def sWildcardMatch(a, b):
|
||||||
|
splt = a.split('*')
|
||||||
|
if len(splt) == 1:
|
||||||
|
return b.startswith(a)
|
||||||
|
return b.startswith(splt[0]) and b.endswith(splt[-1])
|
||||||
|
|
||||||
URIToTest = URIToTest+"/"
|
URIToTest = URIToTest+"/"
|
||||||
for trustedProtocol in constants.TRUSTABLE_WEB_PROTOCOLS:
|
for trustedProtocol in constants.TRUSTABLE_WEB_PROTOCOLS:
|
||||||
if URIToTest.startswith(trustedProtocol):
|
if URIToTest.startswith(trustedProtocol):
|
||||||
@ -513,7 +519,7 @@ class SyncplayClient(object):
|
|||||||
if self._config['trustedDomains']:
|
if self._config['trustedDomains']:
|
||||||
for trustedDomain in self._config['trustedDomains']:
|
for trustedDomain in self._config['trustedDomains']:
|
||||||
trustableURI = ''.join([trustedProtocol, trustedDomain, "/"])
|
trustableURI = ''.join([trustedProtocol, trustedDomain, "/"])
|
||||||
if URIToTest.startswith(trustableURI):
|
if sWildcardMatch(trustableURI, URIToTest):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user