mxcl/homebrew — pull request #22949 by jacknagel (2013-09-30 20:18:00+00:00)
Title: Handle invalid names in download strategies

When subformulae are initialized without a name parameter, Homebrew assigns the name "__UNKNOWN__". This may cause collisions in the cache.

Currently CurlDownloadStrategy and its descendants handles this by extracting the basename form the URL and using that as the cached filename. However, other strategies simply raise an exception.

We can improve the other strategies by URL-encoding the URL string and using that as the cached directory name.

Note that this happens very rarely, especially now that resources (which always have a name) are preferred to subformulae. The most common case is a subformula that specifies a head download.