Smash multiple extensions down into a single one when accepting file

uploads.  Fixes #1872.
This commit is contained in:
Bharat Mediratta
2012-05-17 20:25:27 -07:00
parent 931da5f2ff
commit 9e2ea2ffed
6 changed files with 42 additions and 2 deletions

View File

@@ -797,11 +797,19 @@ class Item_Model_Core extends ORM_MPTT {
if (strpos($this->name, "/") !== false) {
$v->add_error("name", "no_slashes");
return;
} else if (rtrim($this->name, ".") !== $this->name) {
}
if (rtrim($this->name, ".") !== $this->name) {
$v->add_error("name", "no_trailing_period");
return;
}
// Do not accept files with double extensions, they can cause problems on some
// versions of Apache.
if (substr_count($this->name, ".") > 1) {
$v->add_error("name", "illegal_data_file_extension");
}
if ($this->is_movie() || $this->is_photo()) {
$ext = pathinfo($this->name, PATHINFO_EXTENSION);