Only allow zip file prefixes of one directory deep. Partial fix for #118.
1 parent 47eac27 commit 93ca97665f8a8a4bd151e1afa8f600732a64e7cb
@Sönke Ludwig Sönke Ludwig authored on 11 Sep 2013
Showing 1 changed file
View
10
source/dub/packagemanager.d
Path zip_prefix;
auto json_file = PathEntry(PackageJsonFilename);
foreach(ArchiveMember am; archive.directory) {
auto path = Path(am.name);
if( path.length > 1 && path.head == json_file){
if (path.length == 2 && path.head == json_file && path.length) {
zip_prefix = path[0 .. $-1];
break;
}
}
 
if( zip_prefix.empty ){
// not correct zip packages HACK
Path minPath;
foreach(ArchiveMember am; archive.directory)
if( isPathFromZip(am.name) && (minPath == Path() || minPath.startsWith(Path(am.name))) )
zip_prefix = Path(am.name);
}
 
logDebug("zip root folder: %s", zip_prefix);