On 4/8/06, Stephen Colebourne <[EMAIL PROTECTED]> wrote:
>
> From commons-user:
> >>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.
>
> Thats probably the right philosopy for getName(), but shouldn't we have
> a getBaseName() or similarly named method _as_well_ that does the
> stripping of the IE rubbish?


Well, they've already got Commons IO, since FileUpload depends on that, and
that has FileNameUtils.getName() to get just the file name, so do we really
need to add another method in FileUpload that just wraps that call?

And if you think we do, what would we call it? You mentioned getBaseName(),
but there's a method in FileNameUtils with that name that does something
different, so I think that would be confusing.

At present we are forcing every user of [fileupload] to know this naming
> fact and write code to handle it, which surely goes against commons
> philosophy.


String filename = FileNameUtils.getName(item.getName());

instead of:

String file name = item.getName();

doesn't seem so onerous.

--
Martin Cooper


Stephen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to