From 3b1b7bebe35e75f90d523585e9fc255ed289cd4f Mon Sep 17 00:00:00 2001 From: Akira Ohgaki <akiraohgaki@gmail.com> Date: Tue, 11 Oct 2016 06:31:09 +0900 Subject: [PATCH] Data write check --- src/handlers/xdgurl.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/handlers/xdgurl.cpp b/src/handlers/xdgurl.cpp index 36904e2..b245a3b 100644 --- a/src/handlers/xdgurl.cpp +++ b/src/handlers/xdgurl.cpp @@ -121,14 +121,12 @@ void XdgUrl::_saveDownloadedFile(QNetworkReply *reply) QTemporaryFile temporaryFile; - if (!temporaryFile.open()) { + if (!temporaryFile.open() || temporaryFile.write(reply->readAll()) == -1) { result["error"] = QString("save_error"); emit finished(Utility::Json::convertObjToStr(result)); return; } - temporaryFile.write(reply->readAll()); - QMimeDatabase mimeDb; QString mimeType = mimeDb.mimeTypeForFile(temporaryFile.fileName()).name(); -- GitLab