Skip to content

Commit 0493a54

Browse files
committed
Fixed handling static files.
1 parent d9446ac commit 0493a54

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
0.0.18
33
========================
44

5+
- fixed handling static files
6+
57
========================
68
0.0.17
79
========================

controller.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ function send_file(ctrl, path, ext) {
15951595

15961596
var loadstats = function(err, stats, cache) {
15971597

1598-
if (err) {
1598+
if (err || (cache && cache.size === 0)) {
15991599

16001600
if (!DEBUG && ctrl.response.cache)
16011601
F.temporary.notfound[ctrl.uri.cache] = true;
@@ -1657,6 +1657,15 @@ function send_file(ctrl, path, ext) {
16571657
if (ctrl.method === 'HEAD') {
16581658
ctrl.res.end();
16591659
} else {
1660+
1661+
if (end > cache.size || beg > cache.size) {
1662+
// Unexpected file problem
1663+
delete F.temporary.tmp[ctrl.uri.cache];
1664+
ctrl.destroyed = true;
1665+
ctrl.req.destroy();
1666+
return;
1667+
}
1668+
16601669
reader = F.Fs.createReadStream(path, { start: beg, end: end });
16611670

16621671
// Unexpected error

0 commit comments

Comments
 (0)