summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChad Parry <github@chad.parry.org>2011-04-24 00:45:12 -0600
committerChad Parry <github@chad.parry.org>2011-04-24 00:45:12 -0600
commitfcb06bf175bb9eeff36d9c294e97ace9374ef0f3 (patch)
tree02c9903e8fbec6979ec619473f812444fc6b0ca6 /modules
parentc6ef706d70c7e48bea1145eec1b13fb5683e023f (diff)
Don't assign to the item->name field if the name is unchanged, because the save method will crash.
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/models/item.php5
1 files changed, 3 insertions, 2 deletions
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;
}
}