summaryrefslogtreecommitdiff
path: root/src/adblock/adblockhostmatcher.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-09-09 17:03:44 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-09-09 17:03:44 +0200
commit225c2618a66b48e415a20580a12bf4e01ab29ca5 (patch)
tree4eba56f29b3b8b989a0c2889a7ce69b8ec4b7653 /src/adblock/adblockhostmatcher.cpp
parentRevert "This hacks should fix (a lot of) javascript handling." (diff)
downloadrekonq-225c2618a66b48e415a20580a12bf4e01ab29ca5.tar.xz
Fix adblock host matcher
Benjamin Poulain's patch. Thanks :)
Diffstat (limited to 'src/adblock/adblockhostmatcher.cpp')
-rw-r--r--src/adblock/adblockhostmatcher.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/adblock/adblockhostmatcher.cpp b/src/adblock/adblockhostmatcher.cpp
index b11dab2c..75387974 100644
--- a/src/adblock/adblockhostmatcher.cpp
+++ b/src/adblock/adblockhostmatcher.cpp
@@ -32,18 +32,18 @@
bool AdBlockHostMatcher::tryAddFilter(const QString &filter)
{
if (filter.startsWith(QL1S("||"))) {
+
QString domain = filter.mid(2);
- const int indexOfFirstSeparator = domain.indexOf(QL1C('^'));
- if (indexOfFirstSeparator < 0)
+ if (!domain.endsWith(QL1C('^')))
return false;
- const int indexOfLastDollar = domain.lastIndexOf(QL1C('$'));
- if (indexOfLastDollar >= 0 && indexOfLastDollar != indexOfFirstSeparator + 1)
+ if (domain.contains(QL1C('$')))
return false;
- domain = domain.left(indexOfFirstSeparator);
- if (domain.contains(QL1C('/')) || domain.contains(QL1C('*')))
+ domain = domain.left(domain.size() - 1);
+
+ if (domain.contains(QL1C('/')) || domain.contains(QL1C('*')) || domain.contains(QL1C('^')))
return false;
domain = domain.toLower();