From fcb06bf175bb9eeff36d9c294e97ace9374ef0f3 Mon Sep 17 00:00:00 2001 From: Chad Parry Date: Sun, 24 Apr 2011 00:45:12 -0600 Subject: Don't assign to the item->name field if the name is unchanged, because the save method will crash. --- modules/gallery/models/item.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 482b6247..7a08d9c2 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -414,8 +414,9 @@ class Item_Model_Core extends ORM_MPTT { // Preserve the extension of the data file. if (isset($this->data_file)) { $extension = pathinfo($this->data_file, PATHINFO_EXTENSION); - if (!empty($extension)) { - $this->name = pathinfo($this->name, PATHINFO_FILENAME) . ".$extension"; + $new_name = pathinfo($this->name, PATHINFO_FILENAME) . ".$extension"; + if (!empty($extension) && strcmp($this->name, $new_name)) { + $this->name = $new_name; } } -- cgit v1.2.3