Added new target file extension of encryption, ".htm", with consideration of capital...
authorTae-Jeong Lee <taejeong.lee@samsung.com>
Mon, 7 Oct 2013 04:38:32 +0000 (13:38 +0900)
committerSoo-Hyun Choi <sh9.choi@samsung.com>
Mon, 7 Oct 2013 07:18:32 +0000 (16:18 +0900)
[Issue#]   LINUXWRT-983
[Problem]  Some html files included in encryption widget are not encrypted after installation.
[Cause]    wrt-installer decides target files of encryption by refering to each filename extension.
           However, ".htm" was omitted in target list.
[Solution] Added new extension define, ".htm", for encryption.
           Additionally, consideration of capital letter was also added.

Change-Id: If6efdf3f54ead6085631bdd37fec1e23ae10b7ee

src/jobs/widget_install/task_encrypt_resource.cpp

index d032fcd..32b0354 100644 (file)
@@ -30,7 +30,8 @@
 #include <errno.h>
 #include <cstdio>
 #include <sstream>
-#include<iostream>
+#include <iostream>
+#include <algorithm>
 
 #include <memory>
 
@@ -58,6 +59,7 @@ std::set<std::string>& getSupportedForEncryption()
     static std::set<std::string> encryptSet;
     if (encryptSet.empty()) {
         encryptSet.insert(".html");
+        encryptSet.insert(".htm");
         encryptSet.insert(".css");
         encryptSet.insert(".js");
     }
@@ -69,6 +71,9 @@ bool isSupportedForEncryption(const std::string &file)
     size_t foundKey = file.rfind(".");
     if (std::string::npos != foundKey) {
         std::string mimeType = file.substr(foundKey);
+        std::transform(mimeType.begin(), mimeType.end(), mimeType.begin(),
+                       ::tolower);
+
         return getSupportedForEncryption().count(mimeType) > 0;
     }
     return false;