Add error handling logic for unified installer factory 04/235504/6
authorJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 5 Jun 2020 05:52:47 +0000 (14:52 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 7 Aug 2020 09:35:25 +0000 (09:35 +0000)
Installer type may not be determined even GetPkgTypeFromFilename has done.

Change-Id: Ie1781bf3030e22484dd1222ebb96cfcbdcf37616
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/unified/unified_installer_factory.cc

index 78b7bb4686ebd7fc50db6a9960b078e1d95551f5..176f83bb261ec6591dfa3f605e4ad436e599f3a2 100644 (file)
@@ -76,9 +76,13 @@ std::string UnifiedInstallerFactory::GetPkgType(
   if (type.empty())
     type = GetPkgTypeFromPath(info);
 
-  if (type.empty())
-    type = GetPkgTypeFromFilename(
-        boost::filesystem::path(info).filename());
+  if (type.empty()) {
+    std::string file_name =
+        (boost::filesystem::path(info).filename()).string();
+    type = GetPkgTypeFromFilename(file_name);
+    if (type == file_name)
+      type.clear();
+  }
 
   return type;
 }