Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/olympia/addons/tests/test_utils_.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
'Fancy new Add-on for Firefox',
'Fancy new Add-on for Mozilla',
'Better Privacy for Firefox!',
'AAA for Firefox',
'Cor for Mozilla',
'BBB123 for Firefox',
'Foo für Firefox!',
'Bar pour Firefox!',
# Right on the limit of what's acceptable for number of homoglyphs
'BIlIbIlI Helper: BIlIbIlI.com AuxIlIary',
),
Expand All @@ -44,15 +49,22 @@ def test_validate_addon_name_allowed(name):
'Firefox makes everything better',
'Mozilla makes everything better',
'Firefox add-on for Firefox',
'Foobarfor Firefox',
'123 for Firefox',
'😀😀😀 for Firefox',
',,, Firefox',
'XX for Firefox',
'XX for Firefox',
'for Mozilla Firefox',
'Mozilla Firefox',
'Fo for Firefox',
'F i r e f o x',
'F î r \u0435fox',
'FiRѐF0 x',
'F i r \u0435 f o x',
'F\u2800i r e f o x',
'F\u2800 i r \u0435 f o x',
'Fïrefox is great',
'Foobarfor Firefox!',
' for Firefox!', # Too short
'Mozilla',
'm0z1IIa',
'ꮇozilla',
Expand Down
16 changes: 12 additions & 4 deletions src/olympia/addons/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,18 @@ def check_function(normalized_name, variant):

for symbol in amo.MOZILLA_TRADEMARK_SYMBOLS:
symbol_count = variant.count(symbol)
violates_trademark = symbol_count > 1 or (
symbol_count >= 1
# 'XXX for Mozilla' or 'XXX for Firefox' is allowed.
and not normalized_name.endswith(f' for {symbol}')
violates_trademark = (
symbol_count > 1
or (
symbol_count >= 1
# 'XXX for Mozilla' or 'XXX for Firefox' is allowed...
and not normalized_name.endswith(f' {symbol}')
)
or (
symbol_count >= 1
# ...'XX for Firefox' is too short though
and len(variant) < len(symbol) + 6
Comment on lines +45 to +52
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of a nit

Suggested change
symbol_count >= 1
# 'XXX for Mozilla' or 'XXX for Firefox' is allowed...
and not normalized_name.endswith(f' {symbol}')
)
or (
symbol_count >= 1
# ...'XX for Firefox' is too short though
and len(variant) < len(symbol) + 6
symbol_count == 1
and (
# 'XXX for Mozilla' or 'XXX for Firefox' is allowed...
not normalized_name.endswith(f' {symbol}')
# ...'XX for Firefox' is too short though
or len(variant) < len(symbol) + 6
)

)
)

if violates_trademark:
Expand Down
4 changes: 2 additions & 2 deletions src/olympia/devhub/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def test_slug_deny(self):
def test_name_trademark_mozilla(self):
delicious = Addon.objects.get()
form = forms.DescribeForm(
{'name': 'Delicious Mozilla', 'summary': 'foô', 'slug': 'bar'},
{'name': 'Delicious Mozilla Cake', 'summary': 'foô', 'slug': 'bar'},
request=self.request,
instance=delicious,
)
Expand All @@ -709,7 +709,7 @@ def test_name_trademark_mozilla(self):
def test_name_trademark_firefox(self):
delicious = Addon.objects.get()
form = forms.DescribeForm(
{'name': 'Delicious Firefox', 'summary': 'foö', 'slug': 'bar'},
{'name': 'Delicious Firefox Cake', 'summary': 'foö', 'slug': 'bar'},
request=self.request,
instance=delicious,
)
Expand Down
4 changes: 2 additions & 2 deletions src/olympia/files/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ def test_extensions_dont_have_strict_compatibility(self):

@mock.patch('olympia.addons.models.resolve_i18n_message')
def test_mozilla_trademark_disallowed(self, resolve_message):
resolve_message.return_value = 'Notify Mozilla'
resolve_message.return_value = 'Mozilla Notifier'

addon = amo.tests.addon_factory(
file_kw={'filename': 'notify-link-clicks-i18n.xpi'}
Expand All @@ -625,7 +625,7 @@ def test_mozilla_trademark_disallowed(self, resolve_message):

@mock.patch('olympia.addons.models.resolve_i18n_message')
def test_bypass_name_checks(self, resolve_message):
resolve_message.return_value = 'Notify Mozilla'
resolve_message.return_value = 'Mozilla Notifier'

addon = amo.tests.addon_factory(
file_kw={'filename': 'notify-link-clicks-i18n.xpi'}
Expand Down
Loading