mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 04:36:34 +01:00
Fixed Content-Disposition parser to support also filenames not enclosed
with quotes ("filename")
This commit is contained in:
parent
04ec0cfcef
commit
8d357f79da
@ -238,11 +238,14 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply)
|
|||||||
reg.indexIn(value);
|
reg.indexIn(value);
|
||||||
path = QUrl::fromPercentEncoding(reg.cap(1).toUtf8()).trimmed();
|
path = QUrl::fromPercentEncoding(reg.cap(1).toUtf8()).trimmed();
|
||||||
}
|
}
|
||||||
else if (value.contains("filename=\"")) {
|
else if (value.contains("filename=")) {
|
||||||
QRegExp reg("filename=\"(.*)\"");
|
QRegExp reg("filename=([^;]*)");
|
||||||
reg.setMinimal(true);
|
|
||||||
reg.indexIn(value);
|
reg.indexIn(value);
|
||||||
path = reg.cap(1).trimmed();
|
path = reg.cap(1).trimmed();
|
||||||
|
|
||||||
|
if (path.startsWith("\"") && path.endsWith("\"")) {
|
||||||
|
path = path.mid(1, path.length() - 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user