Hi all,
I am trying to block or notify the occurrence of attachments with the same filename in a space. I have been in touch with the clever team at Adaptavist. Their Scriptrunner product has the capacity, using the Listener feature to raise these notifications. Our conversations with Tony at Adaptavist are below.
Is there anyone there who would be interested in creating the Listener script for Confluence Cloud (and Server) proposed by Tony? I'm happy to pay for your efforts or it would be script we could share with the community.
Please let me know! Thanks very much. Steve
Hi Steve,
Unfortunately we are limited in our capacity to help customers with custom coding questions, as these by their very nature are limitless. Atlassian has a community site, which is our preferred venue for custom code Q&A. This also enables us to put information like this in a more public space, so that everyone benefits from the answer. We of course prioritize support covered by our SLA, but we do try to answer community questions when we can.
That said, you should find the Confluence Cloud REST API helpful. You should be able to accomplish what you need making appropriate rest calls to Get content and Get attachments.
I hope you find this information useful.
Kind regards,
Tony
Hi Tony. Thank you very much for your help on this. I will further investigate an event listener. If I need help creating the script can you recommend a team who could do that?
Thanks, Steve
Hi Steve,
It sounds like what you want should be achievable using an event listener which fires on the Attachment Created event. This will give you access to the 'attachments' variable which contains a list of attachments which were uploaded, as well as the 'attachedTo' variable which represents the page.
Further information is available on the Confluence Cloud API documentation, which is linked to from the ScriptRunner Script Listeners page.
I hope this is helpful to you, please let us know if you have anything further.
Kind regards,
Tony
Thanks for raising a request with Adaptavist Support. Please note our team is based in the UK and operate UK working hours, 9am to 5pm Monday to Friday. We try to respond to all new requests within 24 hours.
If your request is about getting help with one of your scripts, please consider using the following resources:
Thanks,
The Adaptavist Support team
hi there, I am trying to block the occurrence of attachments with the same filename in a space. how can I use scriptrunner for confluence cloud to raise an alert when scriptrunner detects two attachments of the same filename within a confluence space?
thanks and kind rgds, Steve
https://productsupport.adaptavist.com/servicedesk/customer/portal/40/SRCLSUP-9
I wrote a script like this for Jira that will compare attachments on ticket A to the attachment being uploaded on ticket B. If it matches any on ticket A the attachment will be deleted. Some of my code could probably be recycled into what you are trying to do. Alas, I do not have ScriptRunner for Confluence. Below are the Community articles I wrote about it.
Remove Jira Issue Attachments by MD5 Hash
Remove Jira Issue Attachments by MD5 Hash Redux
As think about it from a design standpoint you would probably want to persistently store the hashes of all your attachments in the database so that you can compare quickly against the has of the attachment being uploaded. It would probably be a drain on the system to do a realtime scan to get the hashes of all the current attachments when the upload listener fires off.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Davin for your great input.Much appreciated! I'll let all know how I go. Kind Rgds, Steve
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.