commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <mart...@apache.org>
Subject Re: FileItem.getName() (v1.1) always lowercase?
Date Sat, 08 Apr 2006 00:45:07 GMT
On 4/7/06, David Wall <d.wall@computer.org> wrote:
>
>
> >Yes, that is the case. It's a bug that has already been fixed. You can
> pick
> >up a nightly build if you need the fix; that's pretty safe, since nothing
> >else has changed since the 1.1 release.
> >
> >
> Thanks.  Works fine.
>
> >I also noted that IE was uploading with the full path to the file, while
> >
> >
> >>Firefox just sent the file name.  The full path seems like an unexpected
> >>amount of info leakage when sending a file.
> >>
> >>
> >
> >
> >That's not something that Commons FileUpload has any effect on. It's
> >entirely up to the browser to decide what to send. I agree with you that
> >it's more than I'd like to expose, but there's no way around it. Well, I
> >guess there is - don't use IE. ;-)
> >
> >
> True, but I noted that O'Reilly's version just added this snippet to
> remove any trailing / or \:


Right. The Commons FileUpload philosophy, though, is to give you exactly
what the browser sent, no more and no less. It's not up to FileUpload to
determine what the caller wants - some callers may want or need the extra
information if it's available.

--
Martin Cooper


                    // The filename may contain a full path.  Cut to
> just the filename.
>                     int slash = Math.max(filename.lastIndexOf('/'),
> filename.lastIndexOf('\\'));
>                     if (slash > -1) {
>                         filename = filename.substring(slash + 1);  //
> past last slash
>                     }
>
> Thanks,
> David
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message