14 Commits
0.2.1 ... 0.2.2

Author SHA1 Message Date
Sam Soffes
3f5a7b30dc Merge pull request #28 from nivektric/master
Change clean_path to preserve_paths in podspec to pass validation
2012-07-10 12:01:07 -07:00
Kevin Monahan
bdbab4d3b3 Change clean_path to preserve_paths in podspec to pass validation 2012-07-10 14:35:58 -04:00
Sam Soffes
fdb1726299 Merge pull request #27 from nivektric/0.2.2
Bump version number in podspec
2012-07-09 21:39:27 -07:00
Kevin Monahan
709006228c Bump version number in podspec 2012-07-09 23:47:10 -04:00
Sam Soffes
db0c62c481 Bump license year and add podspec 2012-06-02 13:32:57 -07:00
Sam Soffes
d9ea638369 Merge pull request #23 from jparishy/master
Fix for issues with Unicode filenames and Symbolic Links. Fixes #14
2012-05-09 21:32:13 -07:00
Julius Parishy
f18a98e551 Remote old debug NSLogs
Just taking out some NSLogs I missed when cleaning up the source.
2012-05-09 23:55:36 -04:00
Julius Parishy
557e869222 Remove files I accidentally unzipped.
They weren't needed and were cluttering up the directory.
2012-05-09 23:54:47 -04:00
Julius Parishy
26630b36af Fix for mailing tests regarding unicode filenames and symbolic links.
See my note about ZIPs lack of documentation for symbolic links. A lot
of this seems to be trial and error on my part as the implementation
isn't documented. This seems to do the trick, however, and all of the
tests are now passing on my end.

As always, send more problems my way.
2012-05-09 23:53:22 -04:00
Sam Soffes
581adbb98c Don't clean output director for debugging purposes 2012-05-09 09:54:16 -07:00
Sam Soffes
d646bf93a2 Add failing test for #14 2012-05-09 09:53:06 -07:00
Sam Soffes
b7598bc95f Version 0.2.1 2012-05-09 09:53:06 -07:00
Sam Soffes
236fcb7d65 Merge pull request #20 from florianbachmann/master
get rid of these three little warnings
2012-05-09 08:39:01 -07:00
Florian Bachmann
45009d71e7 get rid of these three warnings:
- Missing field 'tm_min' initializer
- Suggest braces around initialization of subobject
- Missing field 'dosDate' initializer
2012-05-09 11:17:44 +02:00
8 changed files with 72 additions and 20 deletions

View File

@@ -1,12 +1,20 @@
# SSZipArchive Changelog
### Version 0.2.1
[Released May 9, 2012](https://github.com/samsoffes/sskeychain/tree/0.2.1)
* Support for symbolic links — [@jparishy](http://github.com/jparishy)
* Fix several warnings
### Version 0.2.0
[Released May 7, 2012](https://github.com/samsoffes/sskeychain/tree/0.2.0)
* Add unzipping delegate
* Add unzipping delegate — [@uppfinnarn](http://github.com/uppfinnarn)
* Fix unzipping with passwords
* Fix modified at dates
* Fix modified at dates — [@brantsears](http://github.com/brantsears)
* Fix truncated files. Ignore the zip headers and unzip until there is no more file. — [@jparishy](http://github.com/jparishy)
### Version 0.1.2

View File

@@ -1,4 +1,4 @@
Copyright (c) 2010-2011 Sam Soffes
Copyright (c) 2010-2012 Sam Soffes
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -11,6 +11,8 @@
#import "zlib.h"
#import "zconf.h"
#include <sys/stat.h>
#define CHUNK 16384
@interface SSZipArchive ()
@@ -116,25 +118,26 @@
// http://www.pkware.com/documents/casestudies/APPNOTE.TXT
//
// ...to deduce this method of detecting whether the file in the ZIP is a symbolic link.
// If it is, it is listed as a directory but has an uncompressed data size greater than
// zero (real directories have it equal to 0) and the included, uncompressed data is the
// symbolic link path.
// If it is, it is listed as a directory but has a data size greater than zero (real
// directories have it equal to 0) and the included, uncompressed data is the symbolic link path.
//
// ZIP files did not originally include support for symbolic links so the specification
// doesn't include anything in them that isn't part of a unix extension that isn't being used
// by the archivers we're testing. Most of this is figured out through trial and error and
// reading ZIP headers in hex editors. This seems to do the trick though.
//
const uLong ZipDirectoryVersion = 10;
const uLong ZipCompressionMethodStore = 0;
BOOL fileIsSymbolicLink = NO;
if((fileInfo.version_needed == ZipDirectoryVersion) && // Is it a directory?
(fileInfo.compression_method == ZipCompressionMethodStore) && // Is it compressed?
(fileInfo.compressed_size > 0)) // Is there any data there?
if((fileInfo.compression_method == ZipCompressionMethodStore) && // Is it compressed?
(S_ISDIR(fileInfo.external_fa)) && // Is it marked as a directory
(fileInfo.compressed_size > 0)) // Is there any data?
{
fileIsSymbolicLink = YES;
}
//NSLog(@"\"%s\" is symbolic link? %@", filename, fileIsSymbolicLink ? @"Yes." : @"No.");
// Check if it contains directory
NSString *strPath = [NSString stringWithCString:filename encoding:NSUTF8StringEncoding];
BOOL isDirectory = NO;

18
SSZipArchive.podspec Normal file
View File

@@ -0,0 +1,18 @@
Pod::Spec.new do |s|
s.name = 'SSZipArchive'
s.version = '0.2.2'
s.summary = 'Utility class for zipping and unzipping files on iOS and Mac.'
s.homepage = 'https://github.com/samsoffes/ssziparchive'
s.author = { 'Sam Soffes' => 'sam@samsoff.es' }
s.source = { :git => 'https://github.com/samsoffes/ssziparchive.git', :tag => '0.2.2' }
s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS and Mac.'
s.source_files = 'SSZipArchive.*', 'minizip/*.{h,c}'
s.library = 'z'
s.preserve_paths = ['Tests', '.gitignore']
s.license = { :type => 'MIT', :file => 'LICENSE' }
# Maintain the dir structure for headers
def s.copy_header_mapping(from)
from
end
end

View File

@@ -17,6 +17,7 @@
B215FB6A143AD576003AC546 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = B215FB53143AD460003AC546 /* unzip.c */; };
B215FB6B143AD576003AC546 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = B215FB55143AD460003AC546 /* zip.c */; };
B215FB6D143AD6FF003AC546 /* TestArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = B215FB6C143AD6FF003AC546 /* TestArchive.zip */; };
B2283D5D155AD80F00F9395A /* Unicode.zip in Resources */ = {isa = PBXBuildFile; fileRef = B2283D5C155AD80F00F9395A /* Unicode.zip */; };
B23FCC7F1558F1B70026375C /* TestPasswordArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = B23FCC7E1558F1B70026375C /* TestPasswordArchive.zip */; };
C5AE4E64155A12760045F3ED /* IncorrectHeaders.zip in Resources */ = {isa = PBXBuildFile; fileRef = C5AE4E63155A12760045F3ED /* IncorrectHeaders.zip */; };
C5AE4E6D155A8B010045F3ED /* SymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = C5AE4E6C155A8B010045F3ED /* SymbolicLink.zip */; };
@@ -41,6 +42,7 @@
B215FB61143AD514003AC546 /* SSZipArchiveTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchiveTests.m; sourceTree = "<group>"; };
B215FB64143AD527003AC546 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
B215FB6C143AD6FF003AC546 /* TestArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestArchive.zip; sourceTree = "<group>"; };
B2283D5C155AD80F00F9395A /* Unicode.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Unicode.zip; sourceTree = "<group>"; };
B23FCC7E1558F1B70026375C /* TestPasswordArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestPasswordArchive.zip; sourceTree = "<group>"; };
C5AE4E63155A12760045F3ED /* IncorrectHeaders.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = IncorrectHeaders.zip; sourceTree = "<group>"; };
C5AE4E6C155A8B010045F3ED /* SymbolicLink.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SymbolicLink.zip; sourceTree = "<group>"; };
@@ -118,6 +120,7 @@
B215FB5E143AD505003AC546 /* SSZipArchiveTests */ = {
isa = PBXGroup;
children = (
B2283D5C155AD80F00F9395A /* Unicode.zip */,
B215FB61143AD514003AC546 /* SSZipArchiveTests.m */,
B215FB5F143AD514003AC546 /* SSZipArchiveTests-Info.plist */,
C5AE4E63155A12760045F3ED /* IncorrectHeaders.zip */,
@@ -184,6 +187,7 @@
B23FCC7F1558F1B70026375C /* TestPasswordArchive.zip in Resources */,
C5AE4E64155A12760045F3ED /* IncorrectHeaders.zip in Resources */,
C5AE4E6D155A8B010045F3ED /* SymbolicLink.zip in Resources */,
B2283D5D155AD80F00F9395A /* Unicode.zip in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -20,9 +20,9 @@
@implementation SSZipArchiveTests
- (void)setUp {
[[NSFileManager defaultManager] removeItemAtPath:[self _cachesPath:nil] error:nil];
}
//- (void)setUp {
// [[NSFileManager defaultManager] removeItemAtPath:[self _cachesPath:nil] error:nil];
//}
- (void)testZipping {
@@ -91,16 +91,35 @@
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
NSString* testSymlink = [outputPath stringByAppendingPathComponent:@"SymbolicLink/GitHub.app"];
NSString *testSymlinkFolder = [outputPath stringByAppendingPathComponent:@"SymbolicLink/GitHub.app"];
NSString *testSymlinkFile = [outputPath stringByAppendingPathComponent:@"SymbolicLink/Icon.icns"];
NSError* error = nil;
NSString* symlinkPath = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath:testSymlink error:&error];
NSError *error = nil;
NSString *symlinkFolderPath = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath:testSymlinkFolder error:&error];
bool symbolicLinkToFolderPersists = ((symlinkFolderPath != nil) && [symlinkFolderPath isEqualToString:@"/Applications/GitHub.app"]) && (error == nil);
bool symbolicLinkPersists = ((symlinkPath != nil) && [symlinkPath isEqualToString:@"/Applications/GitHub.app"]) && (error == nil);
error = nil;
STAssertTrue(symbolicLinkPersists, @"Symbolic links should persist from the original archive to the outputted files.");
NSString *symlinkFilePath = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath:testSymlinkFile error:&error];
bool symbolicLinkToFilePersists = ((symlinkFilePath != nil) && [symlinkFilePath isEqualToString:@"/Applications/GitHub.app/Contents/Resources/AppIcon.icns"]) && (error == nil);
STAssertTrue(symbolicLinkToFilePersists && symbolicLinkToFolderPersists, @"Symbolic links should persist from the original archive to the outputted files.");
}
- (void)testUnzippingWithUnicodeFilenameInside {
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Unicode" ofType:@"zip"];
NSString* outputPath = [self _cachesPath:@"Unicode"];
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
bool unicodeFilenameWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Accént.txt"]];
bool unicodeFolderWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Fólder/Nothing.txt"]];
STAssertTrue(unicodeFilenameWasExtracted, @"Files with filenames in unicode should be extracted properly.");
STAssertTrue(unicodeFolderWasExtracted, @"Folders with names in unicode should be extracted propertly.");
}
// Commented out to avoid checking in several gig file into the repository. Simply add a file named
// `LargeArchive.zip` to the project and uncomment out these lines to test.

Binary file not shown.

BIN
Tests/Unicode.zip Normal file

Binary file not shown.