List Info

Thread: Created: (WW-1911) Content-Type validation when no file is uploaded




Created: (WW-1911) Content-Type validation when no file is uploaded
country flaguser name
United States
2007-05-06 00:37:42
Content-Type validation when no file is uploaded
------------------------------------------------

                 Key: WW-1911
                 URL: https
://issues.apache.org/struts/browse/WW-1911
             Project: Struts 2
          Issue Type: Bug
          Components: Dispatch, Interceptors
    Affects Versions: 2.0.7, 2.0.6, 2.1.0, 2.1.x
         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
            Reporter: Lukasz Racon


If you set allowed types on the file upload interceptor:
<param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>

it will validate content type even though there is no file
uploaded. 
This shows up in two cases:
1) If field is required you will get 2 messages:
Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
Image is required.

2) If field is not required you will get invalid content
type validation error anyway (which prohibits from executing
the action):
Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream

Basically it violates the idea of single purpose validator
(since it also acts as required field validator).

There are at least 3 ways to fix it:
1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
2) fix the ServletFileUpload.parseRequest so it does not
show empty downloads (i.e. when file name is null). 
3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.

Attached patch fixes JakartaMultiPartRequest if file name is
blank it means no file has been uploaded.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


Updated: (WW-1911) Content-Type validation when no file is uploaded
country flaguser name
United States
2007-05-06 00:39:42
     [ https://issues.apache.org/struts/browse/WW-1911?page=com.at
lassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lukasz Racon updated WW-1911:
-----------------------------

    Attachment: patch.txt

here goes the patch.

> Content-Type validation when no file is uploaded
> ------------------------------------------------
>
>                 Key: WW-1911
>                 URL: https
://issues.apache.org/struts/browse/WW-1911
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch, Interceptors
>    Affects Versions: 2.0.6, 2.0.7, 2.1.0, 2.1.x
>         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
>            Reporter: Lukasz Racon
>         Attachments: patch.txt
>
>
> If you set allowed types on the file upload
interceptor:
> <param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>
> it will validate content type even though there is no
file uploaded. 
> This shows up in two cases:
> 1) If field is required you will get 2 messages:
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Image is required.
> 2) If field is not required you will get invalid
content type validation error anyway (which prohibits from
executing the action):
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Basically it violates the idea of single purpose
validator (since it also acts as required field validator).
> There are at least 3 ways to fix it:
> 1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
> 2) fix the ServletFileUpload.parseRequest so it does
not show empty downloads (i.e. when file name is null). 
> 3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.
> Attached patch fixes JakartaMultiPartRequest if file
name is blank it means no file has been uploaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


Updated: (WW-1911) Content-Type validation when no file is uploaded
country flaguser name
United States
2007-05-22 07:21:42
     [ https://issues.apache.org/struts/browse/WW-1911?page=com.at
lassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Don Brown updated WW-1911:
--------------------------

    Fix Version/s: 2.0.9

> Content-Type validation when no file is uploaded
> ------------------------------------------------
>
>                 Key: WW-1911
>                 URL: https
://issues.apache.org/struts/browse/WW-1911
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch, Interceptors
>    Affects Versions: 2.0.6, 2.0.7, 2.1.0, 2.1.x
>         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
>            Reporter: Lukasz Racon
>             Fix For: 2.0.9
>
>         Attachments: patch.txt
>
>
> If you set allowed types on the file upload
interceptor:
> <param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>
> it will validate content type even though there is no
file uploaded. 
> This shows up in two cases:
> 1) If field is required you will get 2 messages:
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Image is required.
> 2) If field is not required you will get invalid
content type validation error anyway (which prohibits from
executing the action):
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Basically it violates the idea of single purpose
validator (since it also acts as required field validator).
> There are at least 3 ways to fix it:
> 1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
> 2) fix the ServletFileUpload.parseRequest so it does
not show empty downloads (i.e. when file name is null). 
> 3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.
> Attached patch fixes JakartaMultiPartRequest if file
name is blank it means no file has been uploaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


Commented: (WW-1911) Content-Type validation when no file is uploaded
country flaguser name
United States
2007-06-08 10:13:26
    [ https://issues.apache.org/struts/browse/WW
-1911?page=com.atlassian.jira.plugin.system.issuetabpanels:c
omment-tabpanel#action_41200 ] 

Lukasz Racon commented on WW-1911:
----------------------------------

Same issue:
https
://issues.apache.org/struts/browse/WW-1976

> Content-Type validation when no file is uploaded
> ------------------------------------------------
>
>                 Key: WW-1911
>                 URL: https
://issues.apache.org/struts/browse/WW-1911
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch, Interceptors
>    Affects Versions: 2.0.6, 2.0.7, 2.1.0, 2.1.x
>         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
>            Reporter: Lukasz Racon
>             Fix For: 2.0.9
>
>         Attachments: patch.txt
>
>
> If you set allowed types on the file upload
interceptor:
> <param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>
> it will validate content type even though there is no
file uploaded. 
> This shows up in two cases:
> 1) If field is required you will get 2 messages:
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Image is required.
> 2) If field is not required you will get invalid
content type validation error anyway (which prohibits from
executing the action):
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Basically it violates the idea of single purpose
validator (since it also acts as required field validator).
> There are at least 3 ways to fix it:
> 1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
> 2) fix the ServletFileUpload.parseRequest so it does
not show empty downloads (i.e. when file name is null). 
> 3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.
> Attached patch fixes JakartaMultiPartRequest if file
name is blank it means no file has been uploaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


Updated: (WW-1911) Content-Type validation when no file is uploaded
country flaguser name
United States
2007-07-19 14:37:12
     [ https://issues.apache.org/struts/browse/WW-1911?page=com.at
lassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

James Holmes updated WW-1911:
-----------------------------

    Fix Version/s:     (was: 2.0.9)
                   2.0.10

Moving to 2.0.10 so that 2.0.9 can be released.

> Content-Type validation when no file is uploaded
> ------------------------------------------------
>
>                 Key: WW-1911
>                 URL: https
://issues.apache.org/struts/browse/WW-1911
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch, Interceptors
>    Affects Versions: 2.0.6, 2.0.7, 2.1.0, 2.1.x
>         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
>            Reporter: Lukasz Racon
>             Fix For: 2.0.10
>
>         Attachments: patch.txt
>
>
> If you set allowed types on the file upload
interceptor:
> <param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>
> it will validate content type even though there is no
file uploaded. 
> This shows up in two cases:
> 1) If field is required you will get 2 messages:
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Image is required.
> 2) If field is not required you will get invalid
content type validation error anyway (which prohibits from
executing the action):
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Basically it violates the idea of single purpose
validator (since it also acts as required field validator).
> There are at least 3 ways to fix it:
> 1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
> 2) fix the ServletFileUpload.parseRequest so it does
not show empty downloads (i.e. when file name is null). 
> 3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.
> Attached patch fixes JakartaMultiPartRequest if file
name is blank it means no file has been uploaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


Assigned: (WW-1911) Content-Type validation when no file is uploaded
country flaguser name
United States
2007-07-23 23:50:05
     [ https://issues.apache.org/struts/browse/WW-1911?page=com.at
lassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

James Holmes reassigned WW-1911:
--------------------------------

    Assignee: James Holmes

> Content-Type validation when no file is uploaded
> ------------------------------------------------
>
>                 Key: WW-1911
>                 URL: https
://issues.apache.org/struts/browse/WW-1911
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch, Interceptors
>    Affects Versions: 2.0.6, 2.0.7, 2.1.0, 2.1.x
>         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
>            Reporter: Lukasz Racon
>            Assignee: James Holmes
>             Fix For: 2.0.10
>
>         Attachments: patch.txt
>
>
> If you set allowed types on the file upload
interceptor:
> <param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>
> it will validate content type even though there is no
file uploaded. 
> This shows up in two cases:
> 1) If field is required you will get 2 messages:
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Image is required.
> 2) If field is not required you will get invalid
content type validation error anyway (which prohibits from
executing the action):
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Basically it violates the idea of single purpose
validator (since it also acts as required field validator).
> There are at least 3 ways to fix it:
> 1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
> 2) fix the ServletFileUpload.parseRequest so it does
not show empty downloads (i.e. when file name is null). 
> 3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.
> Attached patch fixes JakartaMultiPartRequest if file
name is blank it means no file has been uploaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


Updated: (WW-1911) File Upload: content-Type validation fails when no file is uploaded
country flaguser name
United States
2007-07-24 22:38:05
     [ https://issues.apache.org/struts/browse/WW-1911?page=com.at
lassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

James Holmes updated WW-1911:
-----------------------------

    Summary: File Upload: content-Type validation fails when
no file is uploaded  (was: Content-Type validation when no
file is uploaded)

> File Upload: content-Type validation fails when no file
is uploaded
>
------------------------------------------------------------
-------
>
>                 Key: WW-1911
>                 URL: https
://issues.apache.org/struts/browse/WW-1911
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch, Interceptors
>    Affects Versions: 2.0.6, 2.0.7, 2.1.0, 2.1.x
>         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
>            Reporter: Lukasz Racon
>            Assignee: James Holmes
>             Fix For: 2.0.10
>
>         Attachments: patch.txt
>
>
> If you set allowed types on the file upload
interceptor:
> <param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>
> it will validate content type even though there is no
file uploaded. 
> This shows up in two cases:
> 1) If field is required you will get 2 messages:
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Image is required.
> 2) If field is not required you will get invalid
content type validation error anyway (which prohibits from
executing the action):
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Basically it violates the idea of single purpose
validator (since it also acts as required field validator).
> There are at least 3 ways to fix it:
> 1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
> 2) fix the ServletFileUpload.parseRequest so it does
not show empty downloads (i.e. when file name is null). 
> 3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.
> Attached patch fixes JakartaMultiPartRequest if file
name is blank it means no file has been uploaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


Updated: (WW-1911) File Upload: content-type validation fails when no file is uploaded
country flaguser name
United States
2007-07-24 22:40:05
     [ https://issues.apache.org/struts/browse/WW-1911?page=com.at
lassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

James Holmes updated WW-1911:
-----------------------------

    Affects Version/s: 2.0.8
                       2.0.9
              Summary: File Upload: content-type validation
fails when no file is uploaded  (was: File Upload:
content-Type validation fails when no file is uploaded)

> File Upload: content-type validation fails when no file
is uploaded
>
------------------------------------------------------------
-------
>
>                 Key: WW-1911
>                 URL: https
://issues.apache.org/struts/browse/WW-1911
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch, Interceptors
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0,
2.1.x
>         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
>            Reporter: Lukasz Racon
>            Assignee: James Holmes
>             Fix For: 2.0.10
>
>         Attachments: patch.txt
>
>
> If you set allowed types on the file upload
interceptor:
> <param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>
> it will validate content type even though there is no
file uploaded. 
> This shows up in two cases:
> 1) If field is required you will get 2 messages:
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Image is required.
> 2) If field is not required you will get invalid
content type validation error anyway (which prohibits from
executing the action):
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Basically it violates the idea of single purpose
validator (since it also acts as required field validator).
> There are at least 3 ways to fix it:
> 1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
> 2) fix the ServletFileUpload.parseRequest so it does
not show empty downloads (i.e. when file name is null). 
> 3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.
> Attached patch fixes JakartaMultiPartRequest if file
name is blank it means no file has been uploaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


Commented: (WW-1911) File Upload: content-type validation fails when no file is uploaded
country flaguser name
United States
2007-07-24 22:42:05
    [ https://issues.apache.org/struts/browse/WW
-1911?page=com.atlassian.jira.plugin.system.issuetabpanels:c
omment-tabpanel#action_41646 ] 

James Holmes commented on WW-1911:
----------------------------------

Fixed on the 2_0_X branch in SVN revision 559304.

> File Upload: content-type validation fails when no file
is uploaded
>
------------------------------------------------------------
-------
>
>                 Key: WW-1911
>                 URL: https
://issues.apache.org/struts/browse/WW-1911
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch, Interceptors
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0,
2.1.x
>         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
>            Reporter: Lukasz Racon
>            Assignee: James Holmes
>             Fix For: 2.0.10
>
>         Attachments: patch.txt
>
>
> If you set allowed types on the file upload
interceptor:
> <param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>
> it will validate content type even though there is no
file uploaded. 
> This shows up in two cases:
> 1) If field is required you will get 2 messages:
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Image is required.
> 2) If field is not required you will get invalid
content type validation error anyway (which prohibits from
executing the action):
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Basically it violates the idea of single purpose
validator (since it also acts as required field validator).
> There are at least 3 ways to fix it:
> 1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
> 2) fix the ServletFileUpload.parseRequest so it does
not show empty downloads (i.e. when file name is null). 
> 3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.
> Attached patch fixes JakartaMultiPartRequest if file
name is blank it means no file has been uploaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


Resolved: (WW-1911) File Upload: content-type validation fails when no file is uploaded
country flaguser name
United States
2007-07-24 22:48:05
     [ https://issues.apache.org/struts/browse/WW-1911?page=com.at
lassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

James Holmes resolved WW-1911.
------------------------------

    Resolution: Fixed

Fixed on the trunk (Struts 2.1) in SVN revision 559307.

Thanks for the patch! I modified it slightly to remove the
dependency on Jakarta Commons Lang.

> File Upload: content-type validation fails when no file
is uploaded
>
------------------------------------------------------------
-------
>
>                 Key: WW-1911
>                 URL: https
://issues.apache.org/struts/browse/WW-1911
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch, Interceptors
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0,
2.1.x
>         Environment: FireFox 2.0; Tomcat 5.0;
commons-fileupload 1.2
>            Reporter: Lukasz Racon
>            Assignee: James Holmes
>             Fix For: 2.0.10
>
>         Attachments: patch.txt
>
>
> If you set allowed types on the file upload
interceptor:
> <param
name="fileUpload.allowedTypes">image/png,image/
gif,image/jpeg</param>
> it will validate content type even though there is no
file uploaded. 
> This shows up in two cases:
> 1) If field is required you will get 2 messages:
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Image is required.
> 2) If field is not required you will get invalid
content type validation error anyway (which prohibits from
executing the action):
> Content-Type not allowed: image
"upload_1120a017_1125f7d74fc__8000_00000013.tmp"
application/octet-stream
> Basically it violates the idea of single purpose
validator (since it also acts as required field validator).
> There are at least 3 ways to fix it:
> 1) fix
org.apache.struts2.interceptor.FileUploadInterceptor.acceptF
ile method so it does not check content type
(allowedTypesSet) if file is empty.
> 2) fix the ServletFileUpload.parseRequest so it does
not show empty downloads (i.e. when file name is null). 
> 3) (one that is in patch) fix
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est.parse so it ignores files that have blank file name.
> Attached patch fixes JakartaMultiPartRequest if file
name is blank it means no file has been uploaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue
online.


[1-10]

about | contact  Other archives ( Real Estate discussion Medical topics )