Take care of some special cases of extensions with __info.json inside

This commit is contained in:
David Capello 2018-11-28 10:31:02 -03:00
parent a38a23e2e5
commit 93c357a87e

View File

@ -326,8 +326,14 @@ void Extension::uninstallFiles(const std::string& path)
base::remove_directory(dir);
}
TRACE("EXT: Deleting file '%s'\n", infoFn.c_str());
base::delete_file(infoFn);
// Delete __info.json file if it does exist (e.g. maybe the
// "installedFiles" list included the __info.json so the file was
// already deleted, this can happen if the .json file was modified
// by hand/the user)
if (base::is_file(infoFn)) {
TRACE("EXT: Deleting file '%s'\n", infoFn.c_str());
base::delete_file(infoFn);
}
TRACE("EXT: Deleting extension directory '%s'\n", path.c_str());
base::remove_directory(path);
@ -576,6 +582,14 @@ Extension* Extensions::installCompressedExtension(const std::string& zipFn,
LOG("EXT: Original filename in zip <%s>...\n", fn.c_str());
// Do not install __info.json file if it's inside the .zip as
// some users are distirbuting extensions with the __info.json
// file inside.
if (base::string_to_lower(base::get_file_name(fn)) == kInfoJson) {
LOG("EXT: Ignoring <%s>...\n", fn.c_str());
continue;
}
if (!info.commonPath.empty()) {
// Check mismatch with package.json common path
if (fn.compare(0, info.commonPath.size(), info.commonPath) != 0)