# How to make an attachment internal in Jira?

**URL:** <https://community.exalate.com/t/how-to-make-an-attachment-internal-in-jira/4625>\
**Category:** General Questions\
**Tags:** exalate, cloud-jira, azuredevops-jiraclou, jira, migrated\_question\
**Created:** [November 4, 2024, 7:11am UTC](https://community.exalate.com/t/how-to-make-an-attachment-internal-in-jira/4625 "2024-11-04T07:11:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:11am UTC](https://community.exalate.com/t/how-to-make-an-attachment-internal-in-jira/4625/1 "2024-11-04T07:11:09Z")

</div>

_Originally asked by kevin keovilay on 02 March 2021 [(original question)](https://oldcommunity.exalate.com/questions/25069175)_

* * *

Hi,

I have been trouble to find how to make an attachment internal in Jira.

 ![](https://europe1.discourse-cdn.com/flex018/uploads/exalate1/original/1X/c9716fdcc881fda592375cbe824bcdcfd3b57bc1.png)

When synchronizing from AZD to Jira, only my comments are made private, but if there was attachments, they are made publics in Jira.

For the comment, it is documented and I have been doing the following :

```auto
issue.comments = commentHelper.mergeComments(issue, replica, {it.internal = true; it})

```

But for Attachment, it seems there is no way to apply an internal field.

```auto
issue.attachments = attachmentHelper.mergeAttachments(issue, replica)

```

Sincerely,

Kévin

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:11am UTC](https://community.exalate.com/t/how-to-make-an-attachment-internal-in-jira/4625/2 "2024-11-04T07:11:10Z")

</div>

_Answer by Ariel Aguilar on 03 March 2021_

Hi Kevin,

You may want to change the attachments script to:

```auto
replica.attachments = issue.attachments.findAll { a ->
  def isMentionedInPublicComments = replica.comments.any {
    c -> c.body.contains("[^" + a.filename + "]") ||
        (c.body =~ (/!${java.util.regex.Pattern.quote(a.filename)}(\|.*!|!)/.toString())).find()
    }
  isMentionedInPublicComments
}

```

Kind regards,

Ariel

* * *
