attach_rename: flaw in duplicate filename detection resulted in filename(1)(1)(1).ext
This commit is contained in:
parent
20497f1be3
commit
ebef7d6348
@ -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),
|
||||
|
Reference in New Issue
Block a user