From 43965eb877ed24d94b8cfa09f948b7877bcffc24 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 27 Oct 2020 13:23:01 +0100 Subject: Allow blacklist and whitelist at the same time. Whitelist takes precedence. --- src/nam.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/nam.cpp') diff --git a/src/nam.cpp b/src/nam.cpp index 2f3fdd1..798a8e6 100644 --- a/src/nam.cpp +++ b/src/nam.cpp @@ -33,7 +33,14 @@ QNetworkReply* SlxNetworkAccessManager::createRequest(QNetworkAccessManager::Ope } else if (url.host().isEmpty()) { ok = true; } else { - ok = (_list.match(url.toDisplayString(QUrl::NormalizePathSegments)).hasMatch() == _isWhitelist); + auto str = url.toDisplayString(QUrl::NormalizePathSegments); + if (_white.isValid() && _white.match(str).hasMatch()) { + ok = true; + } else if (_black.isValid() && _black.match(str).hasMatch()) { + ok = false; + } else { + ok = true; + } } if (!ok) { return new SlxDisabledNetworkReply(this, req, op); -- cgit v1.2.3-55-g7522