Ryan Barrett 2024-02-26 19:26:47 -08:00
rodzic ed366f8426
commit 42b4541c8d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -537,6 +537,11 @@ class WebTest(TestCase):
self.user.put()
self.assertIsNone(Web.get_or_create('user.com'))
def test_get_or_create_existing_opted_out_normalize_case(self, *_):
self.user.manual_opt_out = True
self.user.put()
self.assertIsNone(Web.get_or_create('uSeR.cOm'))
def test_bad_source_url(self, *mocks):
orig_count = Object.query().count()
@ -2473,7 +2478,7 @@ class WebUtilTest(TestCase):
self.user = self.make_user('user.com', cls=Web)
def test_key_for(self, *_):
for id in 'user.com', 'http://user.com', 'https://user.com/':
for id in 'user.com', 'http://user.com', 'https://user.com/', 'uSeR.cOm':
self.assertEqual(Web(id='user.com').key, Web.key_for(id))
for bad in '', 'foo', 'https://foo/', 'foo bar', 'user.json':

3
web.py
Wyświetl plik

@ -140,7 +140,7 @@ class Web(User, Protocol):
if not key:
return None # opted out
domain = key.id().lower().strip('.')
domain = key.id()
user = super().get_or_create(domain, **kwargs)
if not user.existing:
@ -307,6 +307,7 @@ class Web(User, Protocol):
if not id:
return None
id = id.lower().strip('.')
if util.is_web(id):
parsed = urlparse(id)
if parsed.path in ('', '/'):