From 5d76ec85a500321127ac879ffaa0aabd686bb7bf Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 17 Apr 2012 19:53:13 +0200 Subject: raw download for older revisions --- www/.htaccess | 1 + www/raw.php | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'www') diff --git a/www/.htaccess b/www/.htaccess index 73ba7db..697b6ec 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -9,6 +9,7 @@ RewriteRule ^([0-9]+)/edit$ /edit.php?id=$1 RewriteRule ^([0-9]+)/fork$ /fork.php?id=$1 RewriteRule ^([0-9]+)/raw/(.+)$ /raw.php?id=$1&file=$2 RewriteRule ^([0-9]+)/rev/(.+)$ /revision.php?id=$1&rev=$2 +RewriteRule ^([0-9]+)/rev-raw/(.+)/(.+)$ /raw.php?id=$1&rev=$2&file=$3 RewriteRule ^([0-9]+)/tool/([^/]+)/(.+)$ /tool.php?id=$1&tool=$2&file=$3 RewriteRule ^list$ /list.php diff --git a/www/raw.php b/www/raw.php index 28f7c56..8bda11e 100644 --- a/www/raw.php +++ b/www/raw.php @@ -17,5 +17,10 @@ if ($mimetype === null) { $mimetype = 'text/plain'; } header('Content-Type: ' . $mimetype); -readfile($file->getFullPath()); +if ($repo->hash === null) { + //IIRC readfile is not so memory-intensive for big files + readfile($file->getFullPath()); +} else { + echo $file->getContent(); +} ?> -- cgit v1.2.3