Hi ,
I want to restrict uploading of attachments based on file type for example .exe ,.bat.
I was able to automatically change the status when we attach a file . Is there an available plugin which provides this functionality ?
can anyone plz guide me how i can apply such filter which restricts attaching a specified file type ?
Thanx :)
Community moderators have prevented the ability to post new answers.
You could write a Plugin that exposes a Servlet Filter Module. This Servlet Filter decorates the attachment upload action, checks the filetype and display an error page (rendered directly or via redirect) to the user...
I was trying webwork plugin module to extend the attach file action but was not able to get the file name and check its extension and display an error message. I will try Servlet Filter Module , this will be the first time il use this module, thanx .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Niels,
Thanks for the above answer!
Even I am working on similar case. I tried writing a sevlet filter for intercepting the attachment upload request. But how should I get a attachment upload action and the file type being attached to the issue. I am looking at the AttachFile class. As I am new to this can you please guide me on this issue.
Any help will be much appreciated :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could use org.apache.commons.fileupload.DiskFileUpload.parseRequest() in your servlet filter and then handle the FileItems.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Niels ,
Can you please provide some code example on decorating the filter on the attach file action ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Niels ,
In my servlet filter i get file name , i check for the name and print an error message in the log . However I want to know how i can print an error message to the user .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found this example that provides some pointers for the implementation :)
http://www.d.umn.edu/~tcolburn/cs4531/slides/upload/java-source/UploadFilter.java.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, that's not easily possible. With the servlet filter you could just filter out unwanted files quietly.
If you want a nice error message for the user you could try overriding[1] the AttachFile action, define an own class that extends the class AttachFile and override the doValidation() method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, Thanks Niels, I was able to restrict the attachments of certain types without using the servlet filter and by simply extending the AttachTemporaryFile action and displaying the error message upon attaching files of certain types.
Also you can try modifying the class files for this functionality, but have to keep a track of it during upgrades.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can make a plugin to do that. Implement com.atlassian.jira.issue.AttachmentManager, the default implementation is com.atlassian.jira.issue.managers.DefaultAttachmentManager
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think it is not possible to exchange the DefaultAttachmentManager via a Plugin. You would have to edit the Spring configs directly...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You might want to check out the Attachment Checker for JIRA plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ideas , suggestions welcomed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.