About Jira modules
Customer portal
Project settings UI locations

Attachment validator

Available:

Jira 9.15 and later.

Purpose of this module type

The Attachment validator module allows defining customized validation of Jira issue attachments which will be invoked for all newly attached files. The validation will be executed synchronously, blocking the attachment action until it completes.

The validation may be executed before or after a file is uploaded. If the file content isn't relevant, pre-upload validation should be preferred to optimize overall performance.

Configuration

The root element for the attachment validator module is attachment-validator. It allows configuring the following attributes and child elements:

Attributes

Name

Description

class

The Java class that implements this plugin module. Check the app framework guide to creating plugin module instances.

The class must implement com.atlassian.jira.issue.attachment.validation.PluggableAttachmentValidator.

Additionally, depending on when the validation should occur, the class needs to implement one or both of the following interfaces:

key

The unique identifier of the plugin module.

Required: yes

Default: N/A

i18n-name-key

The localization key for the human-readable name of the plugin module.

Required: -

Default: -

name

The human-readable name of the plugin module.

Required: -

Default: The module key.

Elements

Name

Description

description

A human-readable description of the plugin module. May be specified as the value of this element for plain text or with the key attribute to use the value of a key from the internationalization system.

Required: -

Example

1
2
<attachment-validator key="attachment-file-extension-validator" name="Attachment File Extension Validator"
    i18n-name-key="attachment.validators.plugin.module.file.extension.name"
    class="com.atlassian.jira.plugin.attachment.AttachmentFileExtensionValidator">
    
    <description key="attachment.validators.plugin.module.file.extension.description">
        Validates attachments by filename extensions, preventing uploading of files which do not match configured settings.
    </description>
</attachment-validator>

Rate this page: