mitsuhiko/werkzeug — pull request #486 by jso (2014-01-22 19:17:22+00:00)
Title: modified SharedDataMiddleware to provide correct file size information...

...for resources in zip files, using existing metadata resources in pkg_resources.ZipProvider.

This is important because if resources are served from a zip file, then Content-Length header is 0 and Google Chrome does not display the static file content.

This uses metadata that is already present in the ZipProvider's zipinfo dictionary. The clunkiest part is reconstructing the full path of the entry in the zip file; I couldn't find an easier way to get this through the *Provider interface.

This change should be error-tolerant; if file size cannot be retrieved, then it falls back to 0 as before.