|
|||||||
| Line breaks in allowed_filetypes breaks canUploadFileType | ||||
|---|---|---|---|---|
| Causes valid extensions to be ignored, as line break is part of extension comparison | ||||
Category Unknown |
Affected Version 1.6.0 rc2 |
Priority Unknown |
||
Status Fixed |
Fixed Version 1.6 rc4 |
|||
Submitted 01-21-2008 |
||||
|
||||
|
|
|
|
|
|
Line breaks in allowed_filetypes breaks canUploadFileType
Causes valid extensions to be ignored, as line break is part of extension comparison
When entering a long string for allowed_filetypes via the Admin area, the text-area automatically inserts line breaks, which are written to the database as-is.
When $cfg->canUploadFileType($filename) is called from pipe.php, the line breaks become part of the comparison, as they're not being stripped out as part of $str=ereg_replace(' ','',$this->config['allowed_filetypes']); Any comparison involving an extension that falls on a line-break returns FALSE, instead of TRUE I solved this on my local copy by inserting the following line after the line quoted above: $str=ereg_replace("/\n\r|\r\n|\n|\r/", '',$str); //remove line-breaks. Thus, canUploadFileType() becomes: function canUploadFileType($filename) { $ext = preg_replace("/.*\.(.{3,4})$/", "$1", $filename); $str=ereg_replace(' ','',$this->config['allowed_filetypes']); //remove spaces. $str=ereg_replace("/\n\r|\r\n|\n|\r/", '',$str); //remove line-breaks. $allowed=$str?explode(',',$str):null; return ($ext && is_array($allowed) && in_array(".$ext",$allowed))?TRUE:FALSE; } I'm sure the two ereg_replace calls can be combined into something more elegant |
|
|
| Issue Changed by peter |
|
|
|
| Issue Changed by peter |
|
![]() |
| Issue Tools |
|---|
Subscribe to this issue |