| Index: third_party/zlib/google/zip.cc
|
| diff --git a/third_party/zlib/google/zip.cc b/third_party/zlib/google/zip.cc
|
| index f0180e533c8722a75f0da42352208a48fbf2c729..31f0ace7af89f0fdb997ef8309e7d3fcc131ed8d 100644
|
| --- a/third_party/zlib/google/zip.cc
|
| +++ b/third_party/zlib/google/zip.cc
|
| @@ -94,6 +94,13 @@ bool ExcludeHiddenFilesFilter(const base::FilePath& file_path) {
|
| namespace zip {
|
|
|
| bool Unzip(const base::FilePath& src_file, const base::FilePath& dest_dir) {
|
| + return UnzipWithFilterCallback(src_file, dest_dir,
|
| + base::Bind(&ExcludeNoFilesFilter));
|
| +}
|
| +
|
| +bool UnzipWithFilterCallback(const base::FilePath& src_file,
|
| + const base::FilePath& dest_dir,
|
| + const FilterCallback& filter_cb) {
|
| ZipReader reader;
|
| if (!reader.Open(src_file)) {
|
| DLOG(WARNING) << "Failed to open " << src_file.value();
|
| @@ -109,11 +116,17 @@ bool Unzip(const base::FilePath& src_file, const base::FilePath& dest_dir) {
|
| << reader.current_entry_info()->file_path().value();
|
| return false;
|
| }
|
| - if (!reader.ExtractCurrentEntryIntoDirectory(dest_dir)) {
|
| - DLOG(WARNING) << "Failed to extract "
|
| + if (filter_cb.Run(reader.current_entry_info()->file_path())) {
|
| + if (!reader.ExtractCurrentEntryIntoDirectory(dest_dir)) {
|
| + DLOG(WARNING) << "Failed to extract "
|
| + << reader.current_entry_info()->file_path().value();
|
| + return false;
|
| + }
|
| + } else {
|
| + DLOG(WARNING) << "Skipped file "
|
| << reader.current_entry_info()->file_path().value();
|
| - return false;
|
| }
|
| +
|
| if (!reader.AdvanceToNextEntry()) {
|
| DLOG(WARNING) << "Failed to advance to the next file";
|
| return false;
|
|
|