You are here: Foswiki>Tasks Web>Item11958 (14 Nov 2012, SvenDowideit)Edit Attach

Item11958: Filter out plus (+) chars while attaching files

pencil
Priority: Urgent
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: Configure
Branches:
Reported By: ColasNahaboo
Waiting For:
Last Change By: SvenDowideit
Trying to attach a file with a plus sign in the name results in a broken link.

I think trying to fix this "properly" will be too much trouble, due to the involved semantics of "+" in URLs

I suggest filtering out these chars on upload by adding a + in the config var NameFilter

e.g: changing in lib/Foswiki.spec the line:
$Foswiki::cfg{NameFilter} = qr/[\s\*?~^\$@%`"'&;|<>\[\]#\x00-\x1f]/;

into:
$Foswiki::cfg{NameFilter} = qr/[\s\*?~^\$@%`"'&;|<>\[\]#\x00-\x1f+]/;

And I guess a mention in the release notes telling people to chnage the config of the already-installed Foswikis

-- ColasNahaboo - 19 Jun 2012

we can tell them using a configure checker smile

-- SvenDowideit - 07 Nov 2012

I don't think we can do this. NameFilter is defined as
# Filter-out regex for webnames, topic names, file attachment names, usernames,
# include paths and skin names. This is a filter <b>out</b>, ...

We DO support + in topic names, indeed Item12008 fixed use of + in parent topic names. Adding it to name filter will undo all that.

-- GeorgeClark - 07 Nov 2012

well. thats sad - as that means we need to fix whatever mess attaching files containing '+' makes 'properly'

-- SvenDowideit - 08 Nov 2012

I'm not seeing the issue here, at least on trunk. I've attached file names with spaces, as graphics and linked PDFs, and in every case, the spaces were converted to underscores, and the attachment was uploaded and linked correctly

Can you provide a bit more information on how to actually create the error? Never mind. Figured it out. As you say, if the filename has a + sign in the name, the the link will be rendered with an encoded + %2b. Actually that seem to work for me. The browser treats %2b as a +, not a space. Working fine for me on Foswiki 1.1.6 as well.

-- GeorgeClark - 09 Nov 2012

Well, I checked on my 1.1.5 install and foswiki.org, and... it seem to work now, both in attachments table and embedded link.

Sorry for the false alert, I close this bug.

-- ColasNahaboo - 09 Nov 2012
 

ItemTemplate edit

Summary Filter out plus (+) chars while attaching files
ReportedBy ColasNahaboo
Codebase 1.1.5
SVN Range
AppliesTo Engine
Component Configure
Priority Urgent
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
Release01x01Checkins
Topic revision: r7 - 14 Nov 2012, SvenDowideit
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy