Commit a11829e5 authored by Michal Čihař's avatar Michal Čihař

Ignore file/URL paths in same check

parent 5fc26584
......@@ -215,6 +215,7 @@ DOMAIN_RE = re.compile(
re.IGNORECASE
)
PATH_RE = re.compile(r'(/[a-zA-Z0-9=:?._-]+)+')
class SameCheck(TargetCheck):
'''
......@@ -260,6 +261,9 @@ class SameCheck(TargetCheck):
# Strip domain names/URLs
stripped = DOMAIN_RE.sub('', stripped)
# Strip file/URL paths
stripped = PATH_RE.sub('', stripped)
# Remove some html entities
stripped = stripped.replace(
' ', ' '
......
......@@ -199,3 +199,21 @@ class SameCheckTest(CheckTestCase):
''
)
)
def test_same_path(self):
self.do_test(
False,
(
'/cgi-bin/koha/catalogue/search.pl?q=',
'/cgi-bin/koha/catalogue/search.pl?q=',
''
)
)
self.do_test(
True,
(
'File/directory',
'File/directory',
''
)
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment