Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
duplicate key warning in txp_file.php
Hi Textpattern Devs
While trying to implement file support for the abl_droploader plugin, i found a bug in txp_file.php.
I get a MySQL duplicate key warning and the call stack is displayed, when i try to upload a file that is already in the files folder. This occurs when using the upload-form in the file-list view.
The Problem is caused by a wrong ‘if’ in function file_insert:
$newname = sanitizeForFile($name);
$newpath = build_file_path($file_base_path, $newname);
if (!is_file($newname)) {
$id = file_db_add(doSlash($newname),$category,$permissions,$description,$size,$title);
I think the ‘if’ should look like this:
if (!is_file($newpath)) {
Offline
Re: duplicate key warning in txp_file.php
Thanks for the report. Fixed in r3807.
Offline