1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[Fix:] Fixed downloading of files with broken encoding on windows

- using QString::fromLatin1 and filtering all forbidden chars
  from filename
This commit is contained in:
nowrep 2011-12-13 16:36:45 +01:00
parent 05f1809242
commit 1abb6e8717

View File

@ -193,7 +193,7 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply)
{
QString path;
if (reply->hasRawHeader("Content-Disposition")) {
QString value = reply->rawHeader("Content-Disposition");
QString value = QString::fromLatin1(reply->rawHeader("Content-Disposition"));
int pos = value.indexOf("filename=");
if (pos != -1) {
QString name = value.mid(pos + 9);
@ -207,6 +207,8 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply)
path = reply->url().path();
}
path = qz_filterCharsFromFilename(path);
QFileInfo info(path);
QString baseName = info.completeBaseName();
QString endName = info.suffix();