Package com.atlassian.jira.rest.util
Class AttachmentHelper
java.lang.Object
com.atlassian.jira.rest.util.AttachmentHelper
- Since:
- v5.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final List<com.atlassian.platform.security.file.DetectableFileType> -
Constructor Summary
ConstructorsConstructorDescriptionAttachmentHelper(XsrfInvocationChecker xsrfChecker, JiraAuthenticationContext jiraAuthenticationContext) -
Method Summary
Modifier and TypeMethodDescriptionValidates the uploaded image.validateImage(jakarta.servlet.http.HttpServletRequest request, String filename, Long size) validateImage(jakarta.servlet.http.HttpServletRequest request, String filename, Long size, String contentType) validateImage(InputStream inputStream, String filename, Long size, String contentType) validateImageAfterUpload(File uploadedFile)
-
Field Details
-
IMAGE_CONTENT_TYPES
public static final List<com.atlassian.platform.security.file.DetectableFileType> IMAGE_CONTENT_TYPES
-
-
Constructor Details
-
AttachmentHelper
public AttachmentHelper(XsrfInvocationChecker xsrfChecker, JiraAuthenticationContext jiraAuthenticationContext)
-
-
Method Details
-
validate
public AttachmentHelper.ValidationResult validate(jakarta.servlet.http.HttpServletRequest request, String filename, @Nullable Long size) Validates the uploaded image. Validation includes:- XSRF token check
- Filename check (is it blank)
- Size is not valid (Either not supplied by the client or is 0)
- Filesize is above the max attachment size
- Parameters:
request- where the image data isfilename- filename of imagesize- size of image- Returns:
- Validation result
-
validateImage
public AttachmentHelper.ValidationResult validateImage(jakarta.servlet.http.HttpServletRequest request, String filename, @Nullable Long size) -
validateImage
public AttachmentHelper.ValidationResult validateImage(jakarta.servlet.http.HttpServletRequest request, String filename, @Nullable Long size, String contentType) -
validateImage
public AttachmentHelper.ValidationResult validateImage(InputStream inputStream, String filename, Long size, String contentType) -
validateImageAfterUpload
public List<AttachmentHelper.ValidationResult> validateImageAfterUpload(File uploadedFile) throws IOException - Throws:
IOException
-