{"tizen-manifest.xml", "tpk"},
};
+std::string ValidatePkgType(const std::string& type) {
+ if (type == "tpk" || type == "wgt")
+ return type;
+ else
+ return {};
+}
+
std::string GetPkgTypeFromPkgid(const std::string& pkgid, uid_t uid) {
ci::PkgQueryInterface query(pkgid, uid);
- return query.Type();
+ return ValidatePkgType(query.Type());
}
std::string GetPkgTypeFromPath(const std::string& path) {
if (type.empty())
LOG(ERROR) << "Cannot get pkg type";
unzClose(uf);
- return type;
+
+ return ValidatePkgType(type);
}
std::string GetPkgTypeFromFilename(const boost::filesystem::path& name) {
std::stringstream ss(filename);
std::getline(ss, token, '-');
- return token;
+ return ValidatePkgType(token);
}
} // namespace
std::string type = GetPkgType(pkgmgr->GetRequestInfo(idx),
pkgmgr->GetUid());
- if (type.empty())
+ if (type.empty()) {
+ LOG(ERROR) << "Failed to identify package type, input : "
+ << pkgmgr->GetRequestInfo(idx);
return {};
+ }
std::unique_ptr<ci::AppInstaller> installer;
if (type == "tpk") {