show raw for noncompressed patches
Tue Dec 20 11:36:01 UTC 2005 nils@ndecker.de
* show raw for noncompressed patches
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2015-10-02 17:01:39.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2015-10-02 17:01:39.000000000 +0000
@@ -753,7 +753,14 @@
realf = filter_file(config.repodir + '/_darcs/patches/' + hash)
if not os.path.isfile(realf):
return None
- dsrc = gzip.open(realf)
+ file = open(realf, 'rb')
+ if file.read(2) == '\x1f\x8b':
+ # file begins with gzip magic
+ file.close()
+ dsrc = gzip.open(realf)
+ else:
+ file.seek(0)
+ dsrc = file
return dsrc
def get_darcs_diff(hash, fname = None):