berkshelf/berkshelf — pull request #1123 by mjcdiggity (2014-04-10 16:24:46+00:00)
Title: Fix community cookbook download error 

Ran into an error when downloading a community cookbook, zookeeper-1.6.1, which ended up being caused by the unpacked tar directory containing a `pax_global_header` file and the zookeeper cookbook directory. Berkshelf by default uses the first filename in the extracted directory as the location of the cookbook, which is this case was the `pax_global_header` file, which appears to be a result of using `git archive`. This file was then placed in the cache under the cookbook name and would break the current `berks` as well as future `berks` as the cache could not be loaded.

This fix searches for a filename in the extracted dir that contains the cookbook name, however this assumes the tarball always contains the cookbook within a directory with the same name. The knife cli command for sharing cookbooks follows this convention, but I am not sure if this is true of all community cookbooks.