[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ktorrent] /: Fix gzip not working in ipfilter plugin due to wrong mimetype
From:       Joris Guisson <joris.guisson () gmail ! com>
Date:       2013-08-01 10:51:55
Message-ID: E1V4qU7-0003lW-Bt () scm ! kde ! org
[Download RAW message or body]

Git commit 09421b0222c7552ddcfecbd8c05d8c069a05ba5f by Joris Guisson.
Committed on 01/08/2013 at 10:51.
Pushed by guisson into branch 'master'.

Fix gzip not working in ipfilter plugin due to wrong mimetype

CCBUG: 315239

M  +1    -0    ChangeLog
M  +15   -3    plugins/ipfilter/downloadandconvertjob.cpp

http://commits.kde.org/ktorrent/09421b0222c7552ddcfecbd8c05d8c069a05ba5f

diff --git a/ChangeLog b/ChangeLog
index d0bab55..d84c472 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,7 @@ Changes in 4.3.1:
 - Use extended selection mode in syndication plugin so ctrl key works as expected \
                (308672)
 - Fix crash in GroupViewModel when dragging torrents over groups (308733)
 - Sort by total leechers and seeders, if connected seeders and leechers is equal \
(311470) +- Fix gzip not working in ipfilter plugin due to wrong mimetype (315239)
 
 Changes in 4.3:
 - Change default blocklist url to iblocklist.org (305109)
diff --git a/plugins/ipfilter/downloadandconvertjob.cpp \
b/plugins/ipfilter/downloadandconvertjob.cpp index 76ae319..4b09bee 100644
--- a/plugins/ipfilter/downloadandconvertjob.cpp
+++ b/plugins/ipfilter/downloadandconvertjob.cpp
@@ -114,18 +114,30 @@ namespace kt
 
         //now determine if it's ZIP or TXT file
         KMimeType::Ptr ptr = KMimeType::findByFileContent(temp);
-        if (ptr->name() == "application/zip")
+        Out(SYS_IPF|LOG_NOTICE) << "Mimetype: " << ptr->name() << endl;
+        if(ptr->name() == "application/zip")
         {
             active_job = KIO::file_move(temp, QString(kt::DataDir() + \
                QLatin1String("level1.zip")), -1, KIO::HideProgressInfo | \
                KIO::Overwrite);
             connect(active_job, SIGNAL(result(KJob*)), this, SLOT(extract(KJob*)));
         }
-        else if (ptr->name() == "application/x-gzip" || ptr->name() == \
"application/x-bzip") +        else if(ptr->name() == "application/x-7z-compressed")
+        {
+            QString msg = i18n("7z files are not supported", url.prettyUrl());
+            if (mode == Verbose)
+                KMessageBox::error(0, msg);
+            else
+                notification(msg);
+            
+            setError(UNZIP_FAILED);
+            emitResult();
+        }
+        else if(ptr->name() == "application/gzip" || ptr->name() == \
"application/x-bzip")  {
             active_job = new bt::DecompressFileJob(temp, QString(kt::DataDir() + \
                "level1.txt"));
             connect(active_job, SIGNAL(result(KJob*)), this, SLOT(convert(KJob*)));
             active_job->start();
         }
-        else if(!KMimeType::isBinaryData(temp))
+        else if(!KMimeType::isBinaryData(temp) || ptr->name() == "text/plain")
         {
             active_job = KIO::file_move(temp, QString(kt::DataDir() + "level1.txt"), \
                -1, KIO::HideProgressInfo | KIO::Overwrite);
             connect(active_job, SIGNAL(result(KJob*)), this, SLOT(convert(KJob*)));


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic