summaryrefslogtreecommitdiff
path: root/modules/gallery/models
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2012-05-17 20:25:27 -0700
committerBharat Mediratta <bharat@menalto.com>2012-05-17 20:25:27 -0700
commit9e2ea2ffedb22f83137db4e5ba4c06b91f11e09d (patch)
tree2af0965685141af9cabcb01095dc431954de40e2 /modules/gallery/models
parent931da5f2ff68e3e4414583c39a22d62f13f87960 (diff)
Smash multiple extensions down into a single one when accepting file
uploads. Fixes #1872.
Diffstat (limited to 'modules/gallery/models')
-rw-r--r--modules/gallery/models/item.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 992af0cc..903dadad 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -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);