Refactor support for values in file properties #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improve support for multilingual/multiple values across various methods of
FileProperty
and its variants.Validation will now (correctly) log a message if a value (i.e., a file) is missing, is unparsable, is a rejected MIME type, or exceeds a maximum file size.
Breaking Changes:
Fixed:
Added:
fallbackFilename
to customize generated filename (defaults to property label)hasAcceptedMimetypes()
to check if any custom or fallback MIME types are specifiedgetDefaultAcceptedMimetypes()
to distinguish between custom and fallback MIME types in property variants likeImageProperty
andAudioProperty
assertValidUploadPath()
to ensure upload path exists (or creates it) and checks if writableisAcceptedMimeType()
andisAcceptedFilesize()
generateExtensionFromFile()
,generateExtensionFromMimeType()
, andresolveExtensionFromMimeType()
formatFilesize()
to format bytes into a human-readable unitpathFor()
to make an absolute path to a directory or fileparseValAsFileList()
to flatten value object to simplify validation and parsing of valuesChanged:
getAcceptedMimeTypes()
to newgetDefaultAcceptedMimetypes()
forImageProperty
andAudioProperty
getMimetype()
to retrieve the MIME type of the first valuegetFilesize()
to retrieve the MIME type of the first valuegetMimetype()
andgetFilesize
)dataUpload()
andfileUpload()
to throw exceptionssaveDataUploads()
andsaveDataUploads()
to catch exceptions and log errorsisAccepted*()
methods insidedataUpload()
andfileUpload()
dataUpload()
to generate filename and extension before callinguploadTarget()
uploadTarget()
to simplify making of filenamegenerateFilename()
to usefallbackFilename
and sanitize valueRemoved:
filesize()
,mimetype()
,mimetypeFor()
in favour of their get-prefixed methods