diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-03-21 14:43:57 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-21 14:43:57 +0900 |
commit | 16d176e93ca4a2e3db5ea8d6ff0155bfe47c9067 (patch) | |
tree | c1e0ffabd6498dfd591f5a901b6a4db8e4f5d7b5 | |
parent | 551935c24f66b7db4c6845c8a92cecc980fe3834 (diff) | |
parent | 4e78035d03817c29ceac46bdf9cb045e4ba3a101 (diff) | |
download | libquotient-16d176e93ca4a2e3db5ea8d6ff0155bfe47c9067.tar.gz libquotient-16d176e93ca4a2e3db5ea8d6ff0155bfe47c9067.zip |
Merge pull request #190 from krombel/ignore_content_type_appendix
ignore possible appendixes from content type
-rw-r--r-- | jobs/basejob.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp index 7669d1d4..981b75b1 100644 --- a/jobs/basejob.cpp +++ b/jobs/basejob.cpp @@ -282,9 +282,12 @@ bool checkContentType(const QByteArray& type, const QByteArrayList& patterns) if (patterns.isEmpty()) return true; + // ignore possible appendixes of the content type + const auto ctype = type.split(';').front(); + for (const auto& pattern: patterns) { - if (pattern.startsWith('*') || type == pattern) // Fast lane + if (pattern.startsWith('*') || ctype == pattern) // Fast lane return true; auto patternParts = pattern.split('/'); @@ -292,7 +295,7 @@ bool checkContentType(const QByteArray& type, const QByteArrayList& patterns) "BaseJob: Expected content type should have up to two" " /-separated parts; violating pattern: " + pattern); - if (type.split('/').front() == patternParts.front() && + if (ctype.split('/').front() == patternParts.front() && patternParts.back() == "*") return true; // Exact match already went on fast lane } |