diff options
author | zotlabs <mike@macgirvin.com> | 2016-11-10 20:27:18 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2016-11-10 20:27:18 -0800 |
commit | ebef7d634822d78c39319685a614b72762e123a2 (patch) | |
tree | ea7a2994887a5a7e16784abd78a4e3fb8633195f /include/attach.php | |
parent | 20497f1be30348cddc4c16f7ffa5615cc17a4225 (diff) | |
download | volse-hubzilla-ebef7d634822d78c39319685a614b72762e123a2.tar.gz volse-hubzilla-ebef7d634822d78c39319685a614b72762e123a2.tar.bz2 volse-hubzilla-ebef7d634822d78c39319685a614b72762e123a2.zip |
attach_rename: flaw in duplicate filename detection resulted in filename(1)(1)(1).ext
Diffstat (limited to 'include/attach.php')
-rw-r--r-- | include/attach.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/attach.php b/include/attach.php index f5453096e..ac0185f5d 100644 --- a/include/attach.php +++ b/include/attach.php @@ -2144,6 +2144,10 @@ function attach_move($channel_id, $resource_id, $new_folder_hash) { $ext = ''; } + $matches = false; + if(preg_match('/(.*?)\([0-9]{1,}\)$/',$basename,$matches)) + $basename = $matches[1]; + $v = q("select filename from attach where ( filename = '%s' OR filename like '%s' ) and folder = '%s' ", dbesc($basename . $ext), dbesc($basename . '(%)' . $ext), |