I want to check if a certain attachment exists on a page.
I would like to use the “contains” method of a list, but I can’t get it to work with attachments. Whatever I put into that method, the result is always false.
So I have created a foreach loop instead, which gets slower and slower when there are more and more attachments on a page.
Does anyone have a working example of $attachments.contains() ???
#set($attachmentFound = false)
#set($attachments = $mydoc.getAttachmentList())
#foreach($attachment in $attachments)
#if($attachment.filename == "file_name_with_extension")
#set($attachmentFound = true)
#break
#end
#end