Skip to content

Commit 55a45eb

Browse files
committed
404 error when model does not exist
1 parent d34349f commit 55a45eb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Controller/BlobFileController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ public function serve($model = null, $id = null, $field = null, $size = null) {
2020
$modified = substr($size, 0,10);
2121
$size = substr($size, 10);
2222

23+
if ( ! class_exists($model)) {
24+
throw new NotFoundException($model.' does not exist');
25+
}
26+
27+
if (! $this->{$model}->hasField($field)) {
28+
throw new NotFoundException($field.' field does not exist');
29+
}
30+
2331
$dataset = $this->{$model}->find('first',array(
2432
'conditions' => array(
2533
$model.'.'.$this->{$model}->primaryKey => intval($id)

0 commit comments

Comments
 (0)