mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Extended support for Content-Disposition header (downloads)
This commit is contained in:
parent
a1ff0c0dc4
commit
556c6804ca
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user