Allow all extension while checking for digest verification
Change-Id: Ie17582f144e0a5b5a68e2c6d88c26cb9f5a29ee6
diff --git a/gui/action.cpp b/gui/action.cpp
index 2ca2161..aa96072 100755
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -398,7 +398,7 @@
if (simulate) {
simulate_progress_bar();
} else {
- ret_val = TWinstall_zip(filename.c_str(), wipe_cache);
+ ret_val = TWinstall_zip(filename.c_str(), wipe_cache, (bool) DataManager::GetIntValue(TW_SKIP_DIGEST_CHECK_VAR));
// Now, check if we need to ensure TWRP remains installed...
struct stat st;
diff --git a/twinstall.cpp b/twinstall.cpp
index 427a934..8c3c957 100755
--- a/twinstall.cpp
+++ b/twinstall.cpp
@@ -339,7 +339,7 @@
return INSTALL_SUCCESS;
}
-int TWinstall_zip(const char* path, int* wipe_cache) {
+int TWinstall_zip(const char* path, int* wipe_cache, bool check_for_digest) {
int ret_val, zip_verify = 1, unmount_system = 1;
if (strcmp(path, "error") == 0) {
@@ -352,11 +352,13 @@
string digest_str;
string Full_Filename = path;
- gui_msg("check_for_digest=Checking for Digest file...");
+ if (check_for_digest) {
+ gui_msg("check_for_digest=Checking for Digest file...");
- if (*path != '@' && !twrpDigestDriver::Check_File_Digest(Full_Filename)) {
- LOGERR("Aborting zip install: Digest verification failed\n");
- return INSTALL_CORRUPT;
+ if (*path != '@' && !twrpDigestDriver::Check_File_Digest(Full_Filename)) {
+ LOGERR("Aborting zip install: Digest verification failed\n");
+ return INSTALL_CORRUPT;
+ }
}
}
diff --git a/twinstall.h b/twinstall.h
index f60dd26..406ab6f 100644
--- a/twinstall.h
+++ b/twinstall.h
@@ -1,6 +1,6 @@
#ifndef RECOVERY_TWINSTALL_H_
#define RECOVERY_TWINSTALL_H_
-int TWinstall_zip(const char* path, int* wipe_cache);
+int TWinstall_zip(const char* path, int* wipe_cache, bool check_for_digest = false);
#endif // RECOVERY_TWINSTALL_H_
diff --git a/twrpDigestDriver.cpp b/twrpDigestDriver.cpp
index 0ab94df..0f8eb63 100755
--- a/twrpDigestDriver.cpp
+++ b/twrpDigestDriver.cpp
@@ -70,11 +70,7 @@
if (!TWFunc::Path_Exists(digestfile)) {
delete digest;
- if (Filename.find(".zip") == std::string::npos && Filename.find(".apk") == std::string::npos && Filename.find(".map") == std::string::npos) {
- gui_msg(Msg(msg::kError, "no_digest_found=No digest file found for '{1}'. Please unselect Enable Digest verification to restore.")(Filename));
- } else {
- return true;
- }
+ gui_msg(Msg(msg::kError, "no_digest_found=No digest file found for '{1}'. Please unselect Enable Digest verification to restore.")(Filename));
return false;
}