Scoped tarball rewrites

Tarball rewrite logic was not firing correctly for scoped packages. This fixes it.

It also fixes the issue that tarball links were not escaping the inner '/' in scoped package names, which was confusing route matching.