Package org.exoplatform.upload
Class SvgUploadValidator
java.lang.Object
org.exoplatform.upload.SvgUploadValidator
- All Implemented Interfaces:
UploadFileValidator
Rejects unsafe SVG uploads without modifying the uploaded file.
This validator is intentionally SVG-only. Non-SVG files are not opened or parsed by this class.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
INFECTED_SVG_MESSAGE
- See Also:
-
-
Constructor Details
-
SvgUploadValidator
public SvgUploadValidator() -
SvgUploadValidator
public SvgUploadValidator(long maxSvgValidationSize)
-
-
Method Details
-
supports
- Specified by:
supportsin interfaceUploadFileValidator- Parameters:
fileName- uploaded file namemimeType- detected or enriched MIME type- Returns:
- true only when this validator must inspect the uploaded file
-
validate
public void validate(String fileName, String mimeType, InputStream inputStream) throws org.apache.commons.fileupload2.core.FileUploadException Description copied from interface:UploadFileValidatorValidates the uploaded file in read-only mode.The provided
InputStreamis owned by the caller. Implementations must read from it but must not close it.The stream is expected to be positioned at the beginning of the uploaded content. When several validators support the same file, the caller should provide a fresh stream to each validator.
- Specified by:
validatein interfaceUploadFileValidator- Parameters:
fileName- uploaded file namemimeType- detected or enriched MIME typeinputStream- upload fileInputStream- Throws:
org.apache.commons.fileupload2.core.FileUploadException- when the upload must be rejected
-