[Logo] smithproject.org
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
CFFILE UPLOAD Accept attribute confused by lists containing comma-space  XML
Forum Index -> Smith Development
Author Message
Cars2007



Joined: 25/01/2008 23:52:18
Messages: 20
Offline

Consider the following code, which works in CF5:
Code:
<cffile action="UPLOAD" filefield="something"
     destination="somewhere" nameconflict="MAKEUNIQUE"
     accept="image/gif, image/jpeg, image/png"
     mode="644">

Under Smith, this will work with image/gif, because it is the first item in the list. However, image/jpeg, etc. will not work because Smith is not really looking for "image/jpeg" but for " image/jpeg" (notice the space) in the content type. Ditto image/png and anything else after that.

Changing accept to "image/gif,image/jpeg,image/png" will fix it, but this is probably not the intended behavior.
orcus



Joined: 22/01/2007 16:10:52
Messages: 136
Offline

Cars, thanks for the notice, it will be fixed!

btw. note that recently (after smith-1.3b6 release), the file upload in SVN has been rewritten using apache commons file upload. have you tested this with the latest code from SVN, or with smith-1.3b6 ?

orcus

orcus



Joined: 22/01/2007 16:10:52
Messages: 136
Offline

Tested, fixed, added to SVN, will be included in the next build.

The problem was that whitespace was not ignored in accept...
In FileTagImpl.upload(), line:

Code:
    if (SmithList.ListFindNoCase(accept, mime) == 0) {

replaced with:

Code:
    if (SmithList.ListFindNoCase(accept.replaceAll("[ \t]", ""), mime) == 0) {


 
Forum Index -> Smith Development
Go to:   
Powered by JForum 2.1.6 © JForum Team