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 2013-11-28 18:47:14.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2013-11-28 18:47:15.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):