-
Type: Improvement
-
Status: Open
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: QualifiedToSchedule
-
Component/s: Actions & Filters
-
Tags:
Building a filter that checks the file extension is "complicated" (not complicated, more cumbersome):
- Eiher you must create your custom bean
- Or you must use a complicated EL such as:
<filter id="file-is-docx"> <rule grant="true"> <condition>#{currentDocument.hasSchema("file") && currentDocument.file.content != null && currentDocument.getPropertyValue("file:content").getFilename().indexOf(".docx") > -1}</condition> </rule> </filter>
(which of course is not good. A file named the file.docx.zip would pass the test)
So having something like currentDocument.getFileExtension() which returns "" if the blob is null or there is not file extension, and returns the lowercase file extension would be very nice. For fine tuning, the API could accept a parameter giving the xpath to test (file:content by default)
I understand that in the context of a filter, adding a getFileExtension() API means mainly adding it to DoocumentModel. But still. Would be useful and optimized.