diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-04-17 19:53:13 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-04-17 19:53:13 +0200 |
| commit | 5d76ec85a500321127ac879ffaa0aabd686bb7bf (patch) | |
| tree | a64cf47a47ea70bad57ba0c7ec10dd05465811f1 /www | |
| parent | 7290b224b0ddeb369349d61f928190b96b6013b1 (diff) | |
| download | phorkie-5d76ec85a500321127ac879ffaa0aabd686bb7bf.tar.gz phorkie-5d76ec85a500321127ac879ffaa0aabd686bb7bf.zip | |
raw download for older revisions
Diffstat (limited to 'www')
| -rw-r--r-- | www/.htaccess | 1 | ||||
| -rw-r--r-- | www/raw.php | 7 |
2 files changed, 7 insertions, 1 deletions
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(); +} ?> |
