From cb49bbc86307dd44e23c1bf773c29eefa2d10c6b Mon Sep 17 00:00:00 2001 From: Akira Ohgaki <akiraohgaki@gmail.com> Date: Thu, 20 Oct 2016 07:44:16 +0900 Subject: [PATCH] Allow html file --- src/handlers/xdgurl.cpp | 21 --------------------- src/qml/main.qml | 1 - 2 files changed, 22 deletions(-) diff --git a/src/handlers/xdgurl.cpp b/src/handlers/xdgurl.cpp index a555365..16b389c 100644 --- a/src/handlers/xdgurl.cpp +++ b/src/handlers/xdgurl.cpp @@ -1,7 +1,6 @@ #include <QUrl> #include <QUrlQuery> #include <QTemporaryFile> -#include <QMimeDatabase> #include <QNetworkReply> #include <QDesktopServices> @@ -108,16 +107,6 @@ void XdgUrl::_saveDownloadedFile(QNetworkReply *reply) return; } - QMimeDatabase mimeDb; - QString mimeType = mimeDb.mimeTypeForFile(temporaryFile.fileName()).name(); - - if (mimeType == "text/html" || mimeType == "application/xhtml+xml") { - result["status"] = QString("error_filetype"); - result["message"] = QString("The file is unsupported file type " + mimeType); - emit error(Utility::Json::convertObjToStr(result)); - return; - } - QString type = _metadata["type"].toString(); QString destination = _destinations[type].toString(); QString path = destination + "/" + _metadata["filename"].toString(); @@ -152,16 +141,6 @@ void XdgUrl::_installDownloadedFile(QNetworkReply *reply) return; } - QMimeDatabase mimeDb; - QString mimeType = mimeDb.mimeTypeForFile(temporaryFile.fileName()).name(); - - if (mimeType == "text/html" || mimeType == "application/xhtml+xml") { - result["status"] = QString("error_filetype"); - result["message"] = QString("The file is unsupported file type " + mimeType); - emit error(Utility::Json::convertObjToStr(result)); - return; - } - QString type = _metadata["type"].toString(); QString destination = _destinations[type].toString(); QString path = destination + "/" + _metadata["filename"].toString(); diff --git a/src/qml/main.qml b/src/qml/main.qml index f2b6cfa..674523a 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -104,7 +104,6 @@ Window { 'success_install': 'Installation successfull', 'error_validation': 'Validation error', 'error_network': 'Network error', - 'error_filetype': 'File type error', 'error_save': 'Saving file failed', 'error_install': 'Installation failed' }; -- GitLab