Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-06-07 15:02:47

developr
Plugin Author
From: Basel
Registered: 2011-09-24
Posts: 65
Website

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

#2 2012-06-10 06:53:51

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: duplicate key warning in txp_file.php

Thanks for the report. Fixed in r3807.

Offline

Board footer

Powered by FluxBB