Interface BeforeUploadAttachmentValidator

All Superinterfaces:
PluggableAttachmentValidator
All Known Implementing Classes:
AttachmentFileExtensionValidator

@ExperimentalApi @ParametersAreNonnullByDefault public interface BeforeUploadAttachmentValidator extends PluggableAttachmentValidator
Validates attachment before the file is uploaded to Jira.
  • Method Details

    • validateBeforeUpload

      Optional<AttachmentValidationError> validateBeforeUpload(@Nullable ApplicationUser user, Project project, @Nullable Issue issue, PluggableAttachmentValidator.FileInfo fileInfo)
      Validate attachment before the file is uploaded to Jira.

      This validation will be executed synchronously, blocking the attachment action until it completes. Returning a validation error will prevent completion of the action.

      Any thrown exceptions will be interpreted as lack of problems discovered (as if an empty result was returned).

      Parameters:
      user - user performing the action, or null if anonymous
      project - project of the issue to witch the file is being attached to
      issue - issue to which the file is being attached to, or null if the issue does not exist yet (issue will be created with the attachment)
      fileInfo - information about the attached file
      Returns:
      an optional validation error