diff --git a/src/lib/downloads/downloadfilehelper.cpp b/src/lib/downloads/downloadfilehelper.cpp index 7f454dd71..1b57c491f 100644 --- a/src/lib/downloads/downloadfilehelper.cpp +++ b/src/lib/downloads/downloadfilehelper.cpp @@ -228,13 +228,13 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply) QString value = QString::fromLatin1(reply->rawHeader("Content-Disposition")); // We try to use UTF-8 encoded filename first if present - if (value.contains("filename*=UTF-8")) { - QRegExp reg("filename\\*=UTF-8''([^;]*)"); + if (value.contains(QRegExp("filename\\s*\\*\\s*=\\s*UTF-8", Qt::CaseInsensitive))) { + QRegExp reg("filename\\s*\\*\\s*=\\s*UTF-8''([^;]*)", Qt::CaseInsensitive); reg.indexIn(value); path = QUrl::fromPercentEncoding(reg.cap(1).toUtf8()).trimmed(); } - else if (value.contains("filename=")) { - QRegExp reg("filename=([^;]*)"); + else if (value.contains(QRegExp("filename\\s*=", Qt::CaseInsensitive))) { + QRegExp reg("filename\\s*=([^;]*)", Qt::CaseInsensitive); reg.indexIn(value); path = reg.cap(1).trimmed();