You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jelmer Kuperus (JIRA)" <ji...@apache.org> on 2008/04/07 19:22:58 UTC

[jira] Created: (WW-2580) Add filename argument to acceptFile method in FileUploadInterceptor

Add filename argument to acceptFile method in FileUploadInterceptor
-------------------------------------------------------------------

                 Key: WW-2580
                 URL: https://issues.apache.org/struts/browse/WW-2580
             Project: Struts 2
          Issue Type: New Feature
    Affects Versions: 2.0.11.1
            Reporter: Jelmer Kuperus


It would be quite usefull to extend the acceptFile  method in FileUploadInterceptor with an additional argument that passes in the original filename. This allows you to filter uploads based on its extension / name and not merely on the content type. 

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


[jira] Updated: (WW-2580) Add filename argument to acceptFile method in FileUploadInterceptor

Posted by "Jelmer Kuperus (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jelmer Kuperus updated WW-2580:
-------------------------------

    Attachment: patch2.diff

adds filename argument to acceptFile method and adds allowedExtensions property

> Add filename argument to acceptFile method in FileUploadInterceptor
> -------------------------------------------------------------------
>
>                 Key: WW-2580
>                 URL: https://issues.apache.org/struts/browse/WW-2580
>             Project: Struts 2
>          Issue Type: New Feature
>    Affects Versions: 2.0.11.1
>            Reporter: Jelmer Kuperus
>         Attachments: patch2.diff
>
>
> It would be quite usefull to extend the acceptFile  method in FileUploadInterceptor with an additional argument that passes in the original filename. This allows you to filter uploads based on its extension / name and not merely on the content type. 

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


[jira] Updated: (WW-2580) Add filename argument to acceptFile method in FileUploadInterceptor

Posted by "Jelmer Kuperus (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jelmer Kuperus updated WW-2580:
-------------------------------

    Attachment: patch1.diff

merely adds filename argument to acceptfile

> Add filename argument to acceptFile method in FileUploadInterceptor
> -------------------------------------------------------------------
>
>                 Key: WW-2580
>                 URL: https://issues.apache.org/struts/browse/WW-2580
>             Project: Struts 2
>          Issue Type: New Feature
>    Affects Versions: 2.0.11.1
>            Reporter: Jelmer Kuperus
>         Attachments: patch1.diff, patch2.diff
>
>
> It would be quite usefull to extend the acceptFile  method in FileUploadInterceptor with an additional argument that passes in the original filename. This allows you to filter uploads based on its extension / name and not merely on the content type. 

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


[jira] Commented: (WW-2580) Add filename argument to acceptFile method in FileUploadInterceptor

Posted by "James Mitchell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43591#action_43591 ] 

James Mitchell commented on WW-2580:
------------------------------------

Jelmer, are you already doing this in your app?  How did you implement it?

I see 2 ways to do this, but you have not provided a patch for either.

I'd be happy to commit your patch and associated test case when you upload them.  However, keeping "nice to have" jira issues/features hanging around with an "open" status is not my idea of progress.

Please submit a patch or a hint at how you would do it so this issue can be resolved.

Thanks.


> Add filename argument to acceptFile method in FileUploadInterceptor
> -------------------------------------------------------------------
>
>                 Key: WW-2580
>                 URL: https://issues.apache.org/struts/browse/WW-2580
>             Project: Struts 2
>          Issue Type: New Feature
>    Affects Versions: 2.0.11.1
>            Reporter: Jelmer Kuperus
>
> It would be quite usefull to extend the acceptFile  method in FileUploadInterceptor with an additional argument that passes in the original filename. This allows you to filter uploads based on its extension / name and not merely on the content type. 

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


[jira] Commented: (WW-2580) Add filename argument to acceptFile method in FileUploadInterceptor

Posted by "Jelmer Kuperus (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43596#action_43596 ] 

Jelmer Kuperus commented on WW-2580:
------------------------------------

In our app I basically made a copy of FileUploadInterceptor similar to the one included in patch2.diff  to add this behaviour

The other option would have been to check for the extension in the action itself after binding.

I attached 2 patches,

patch1.diff - merely adds an filename argument to the acceptFile method. This allows subclasses to do the filtering on extension themselfes

patch2.diff - adds the filename argument to acceptFile but also adds a allowedExtensions property to the interceptor.

I think its a pretty common usecase to do checks based on file extension rather than mimetype so i would definitely prefer patch2 to be applied

I tried to keep the modifications as similar to the original code as possible so java 4 syntax is used for loops etc 

> Add filename argument to acceptFile method in FileUploadInterceptor
> -------------------------------------------------------------------
>
>                 Key: WW-2580
>                 URL: https://issues.apache.org/struts/browse/WW-2580
>             Project: Struts 2
>          Issue Type: New Feature
>    Affects Versions: 2.0.11.1
>            Reporter: Jelmer Kuperus
>         Attachments: patch1.diff, patch2.diff
>
>
> It would be quite usefull to extend the acceptFile  method in FileUploadInterceptor with an additional argument that passes in the original filename. This allows you to filter uploads based on its extension / name and not merely on the content type. 

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


[jira] Assigned: (WW-2580) Add filename argument to acceptFile method in FileUploadInterceptor

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso reassigned WW-2580:
-----------------------------------

    Assignee: Musachy Barroso

> Add filename argument to acceptFile method in FileUploadInterceptor
> -------------------------------------------------------------------
>
>                 Key: WW-2580
>                 URL: https://issues.apache.org/struts/browse/WW-2580
>             Project: Struts 2
>          Issue Type: New Feature
>    Affects Versions: 2.0.11.1
>            Reporter: Jelmer Kuperus
>            Assignee: Musachy Barroso
>             Fix For: 2.2.x
>
>         Attachments: patch1.diff, patch2.diff
>
>
> It would be quite usefull to extend the acceptFile  method in FileUploadInterceptor with an additional argument that passes in the original filename. This allows you to filter uploads based on its extension / name and not merely on the content type. 

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


[jira] Updated: (WW-2580) Add filename argument to acceptFile method in FileUploadInterceptor

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown updated WW-2580:
--------------------------

    Fix Version/s: 2.2.x

> Add filename argument to acceptFile method in FileUploadInterceptor
> -------------------------------------------------------------------
>
>                 Key: WW-2580
>                 URL: https://issues.apache.org/struts/browse/WW-2580
>             Project: Struts 2
>          Issue Type: New Feature
>    Affects Versions: 2.0.11.1
>            Reporter: Jelmer Kuperus
>             Fix For: 2.2.x
>
>         Attachments: patch1.diff, patch2.diff
>
>
> It would be quite usefull to extend the acceptFile  method in FileUploadInterceptor with an additional argument that passes in the original filename. This allows you to filter uploads based on its extension / name and not merely on the content type. 

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


[jira] Resolved: (WW-2580) Add filename argument to acceptFile method in FileUploadInterceptor

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-2580.
---------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.2.x)
                   2.1.3

Merged into trunk. Thanks for the patch.

> Add filename argument to acceptFile method in FileUploadInterceptor
> -------------------------------------------------------------------
>
>                 Key: WW-2580
>                 URL: https://issues.apache.org/struts/browse/WW-2580
>             Project: Struts 2
>          Issue Type: New Feature
>    Affects Versions: 2.0.11.1
>            Reporter: Jelmer Kuperus
>            Assignee: Musachy Barroso
>             Fix For: 2.1.3
>
>         Attachments: patch1.diff, patch2.diff
>
>
> It would be quite usefull to extend the acceptFile  method in FileUploadInterceptor with an additional argument that passes in the original filename. This allows you to filter uploads based on its extension / name and not merely on the content type. 

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