Closed GoogleCodeExporter closed 9 years ago
Here are a couple of relevant lines from the Apache error log. (IPs, URLs, and
system paths have been lightly sanitized.)
[Wed Jan 18 02:03:48 2012] [error] [client 192.168.1.2] MOLLIFY ERROR:
ServiceException: FILE_ALREADY_EXISTS=, referer: http://www.example.com/mollify/
[Wed Jan 18 02:03:48 2012] [error] [client 192.168.1.2] MOLLIFY ERROR:
{0:{file:/var/www/htdocs/example.com/mollify/backend/include/filesystem/Filesyst
emItem.class.php, line:176, function:createFile, class:LocalFilesystem,
type:->, args:{0:FILESYSTEMITEM Folder (LocalFilesystem): [4f166642ea041] =
'AlbumCovers' (), 1:Capture_0000.JPG}},
1:{file:/var/www/htdocs/example.com/mollify/backend/include/filesystem/Filesyste
mController.class.php, line:567, function:createFile, class:Folder, type:->,
args:{0:Capture_0000.JPG}},
2:{file:/var/www/htdocs/example.com/mollify/backend/plugin/Plupload/PluploadHand
ler.class.php, line:95, function:uploadFrom, class:FilesystemController,
type:->, args:{0:FILESYSTEMITEM Folder (LocalFilesystem): [4f166642ea041] =
'AlbumCovers' (), 1:Capture_0000.JPG, 2:Resource id #53}},
3:{file:/var/www/htdocs/example.com/mollify/backend/plugin/Plupload/PluploadServ
ices.class.php, line:40, function:uploadTo, class:PluploadHandler, type:->,
args:{0:FILESYSTEMITEM Folder (LocalFilesystem): [4f166642ea041] =
'AlbumCovers' (), 1:/tmp, 2:FILESYSTEMCONTROLLER}},
4:{file:/var/www/htdocs/example.com/mollify/backend/include/services/ServicesBas
e.class.php, line:60, function:processPost, class:PluploadServices, type:->,
args:{}},
5:{file:/var/www/htdocs/example.com/mollify/backend/include/MollifyBackend.class
.php, line:78, function:processRequest, class:ServicesBase, type:->, args:{}},
6:{file:/var/www/htdocs/example.com/mollify/backend/r.php, line:57,
function:processRequest, class:MollifyBackend, type:->, args:{0:Request}}},
referer: http://www.example.com/mollify/
Original comment by aberk...@gmail.com
on 18 Jan 2012 at 9:02
Could you try commenting out PluploadHandler.class.php line 42, it is the only
line that processes the file name in any way.
Original comment by samuli.j...@gmail.com
on 18 Jan 2012 at 7:06
Yup. That line was the problem.
I commented it out. The uploads worked.
The intent of the code was to remove slashes and quotes. The original line was:
$fileName = preg_replace("/[\47\92\34\39]+/", "", $fileName);
There are a few problems here. The first is that all backslashes have to be
doubled in regular expression strings. The second is that characters either
need to be expressed in octal or hex. So the statement above was removing an
odd mix that included the digits 2 and 9.
I rewrote the statement as:
$fileName = preg_replace("/[\\x2f\\x5c\\x22\\x27]+/", "", $fileName);
I tested the new statement by trying to upload files with slashes and quotes.
It behaved as expected, properly striping out those characters but otherwise
not mangling the filenames as it had before.
Thank you for pointing me in the right direction.
Original comment by aberk...@gmail.com
on 19 Jan 2012 at 10:10
You are right, thanks for correcting the regex pattern. I wonder how I didn't
notice that :)
Original comment by samuli.j...@gmail.com
on 19 Jan 2012 at 6:20
Fixed in Plupload 1.0.8
Original comment by samuli.j...@gmail.com
on 19 Jan 2012 at 6:23
Original issue reported on code.google.com by
aberk...@gmail.com
on 18 Jan 2012 at 8:55