开发者

Mercurial Web Server - Why am I downloading a .bz2.tar file instead of a .tar.bz2 file?

It is开发者_Python百科 my understanding that a .tar file contains directories and other files, and a .bz2 is a file that's compressed with bzip2 compression.

Therefore, most tarballs with bzip2 compression end in:

.tar.bz2

Which is bzip2 compression applied to a tarball.

However, whenever I download source code from a Mercurial webserver, either the internal one that you get from:

hg serve

Or from BitBucket, I get something that ends in

.bz2.tar

Which doesn't make sense to me, because you can't apply bzip2 compression on multiple files, which is why you need to "tar" them up first.

Is this a bug in Mercurial? Or is this a bug in my web browser (I've tried Google Chrome in Windows and Firefox in Ubuntu)? Or is this something that's just weird but doesn't make a difference?

The latest source that I downloaded was from http://bitbucket.org/bos/hgbook which is the repository for the Mercurial book.


I think I see the problem. The Content-Type header in the download is wonky:

% GET -Ssed http://host/mayorguard/archive/tip.tar.bz2
GET http://ry4an.org/hg/mayorguard/archive/tip.tar.bz2 --> 200 Script output follows
Connection: close
Date: Mon, 20 Sep 2010 19:01:00 GMT
Server: Apache/2.2.14 (Ubuntu)
Content-Type: application/x-tar
Client-Date: Mon, 20 Sep 2010 19:01:00 GMT
Client-Peer: 75.146.191.221:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Content-Disposition: attachment; filename=mayorguard-dee99508cd77.tar.bz2

Notice the Content-Disposition header suggests the browser use a filename with the correct extension, but the Content-Type header says it's a .tar file. When I do that download in Google Chrome I get a resulting file named mayorguard-hashid.tar.gz.tar which isn't right.

The example above was from hgweb and the one below is from bitbucket:

% GET -Ssed http://bitbucket.org/mailchimp/etsy-php/get/000000000000.bz2
GET http://bitbucket.org/mailchimp/etsy-php/get/000000000000.bz2 --> 200 OK
Cache-Control: max-age=1800
Connection: close
Date: Mon, 20 Sep 2010 19:05:16 GMT
Accept-Ranges: bytes
Server: nginx/0.7.67
Content-Length: 189
Content-Type: application/x-tar
Expires: Mon, 20 Sep 2010 19:35:16 GMT
Last-Modified: Mon, 20 Sep 2010 19:05:16 GMT
Client-Date: Mon, 20 Sep 2010 19:05:16 GMT
Client-Peer: 207.223.240.182:80
Client-Response-Num: 1
Content-Disposition: attachment; filename=etsy-php-000000000000.bz2

I'd say that Mercurial is giving bad info and the browser is overthinking the filename.


This is a bug in bitbucket, please report it to them: http://bitbucket.org/jespern/bitbucket/issues/new/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜