commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <>
Subject Re: [fileupload] FileItem.getName() IE prefix
Date Sat, 08 Apr 2006 17:15:34 GMT
On 4/8/06, Stephen Colebourne <> 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

> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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