I think that it is sufficient to provide option to pass "" empty extension,
e.g.: "jpg,png,"

It will mean "no extension" as well as "empty extension" (isn't it
incredibly rare case?).


On Sat, Jul 6, 2013 at 4:29 PM, simone83 <notifications@github.com> wrote:

> In input/ui/src/main/java/org/richfaces/request/BaseUploadedFile.java:
>
> > @@ -73,4 +73,16 @@ public String getContentType() {
> >              Closeables.closeQuietly(is);
> >          }
> >      }
> > +
> > +    @Override
> > +    public String getFileExtension() {
> > +        String name = this.getName();
> > +        if (name != null) {
> > +            int i = name.lastIndexOf('.');
> > +            if (i > 0) {
> > +                return name.substring(i + 1);
>
> surely, is legal in winblows os'es too, but the question is that: the user
> specifies an acceptedTypes list-comma separated string inside the page in
> the rich:fileUpload component, and this must be a list of extensions
> without the '.' dot.
> Inside the component reference spec. the use of dots however is not
> explicitly required...
> ------------------------------
>
> acceptedTypes
>
> The acceptedTypes parameter defines comma separated list of file
> extensions accepted by component. The component does not provide any
> feedback when rejecting file. For introducing feedback for rejection, use
> ontyperejected parameter
> ------------------------------
>
> ...so if we implicit take the assumption (as the example source code in
> showcase does) that we must pass a string of comma separated extensions
> without dot '.' prefixes, the only way the user can specify an empty file
> extension is when he inserts a comma followed by 0 or more spaces or
> vice-versa if it is the first entry in the acceptedTypes string.
> If you try to do that, the actual implementation will upload each file
> without care of extension (i have to look inside code deeply to understand
> if it's a bug or it is a sort of failed validation of acceptedTypes list
> behaviour, then it will disable the effects of acceptedTypes attribute at
> all...try it yourself!).
> So we have to modify the acceptedTypes to require the "." prefix, then the
> user can specify an acceptedTypes=".,.JPG,.PNG" for example...otherwise, as
> it is now, it make sense to reject the "noextension." files because they
> have and empty extension that it will represented by an empty string and
> the users actually cannot specify that inside the acceptedTypes because as
> i sayed before inserting a comma followed by an empty string will change
> the expected behaviour, disabling the per-extension upload filter ...WDYT?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/richfaces4/components/pull/78/files#r5052766>
> .
>