diff --git a/SSZipArchive/SSZipArchive.m b/SSZipArchive/SSZipArchive.m index 08348dfa..0413993c 100755 --- a/SSZipArchive/SSZipArchive.m +++ b/SSZipArchive/SSZipArchive.m @@ -325,7 +325,8 @@ + (BOOL)unzipFileAtPath:(NSString *)path crc_ret = unzCloseCurrentFile( zip ); if (crc_ret == UNZ_CRCERROR) { //CRC ERROR - return NO; + success = NO; + break; } ret = unzGoToNextFile( zip ); @@ -375,9 +376,19 @@ + (BOOL)unzipFileAtPath:(NSString *)path [delegate zipArchiveProgressEvent:fileSize total:fileSize]; } + NSError *retErr = nil; + if (crc_ret == UNZ_CRCERROR) + { + NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"crc check failed for file"}; + retErr = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-3 userInfo:userInfo]; + } + if (error) + { + *error = retErr; + } if (completionHandler) { - completionHandler(path, YES, nil); + completionHandler(path, success, retErr); } return success; }