This question about Using an extension: Task closed

Spaces are not removed from filenames, this leads to broken links when done in Wiki style.

I am using TopicInteractionPlugin 3.51, Foswiki 1.1.9. If someone uploads a file which has spaces in its name, the spaces are NOT removed from the name, as it used to be. Though it gets rendered correctly. In 'Edit Wiki Text' mode one can write something like

[[%ATTACHURLPATH%/FilenameWithSpaces][FilenameWithSpaces]].

However, if one opens this page in WYSIWYG editing and just save it, the link gets broken to something like

[[%ATTACHURLPATH%/StuffBeforeFirstSpace]].

Could one have a possibility to switch On/Off space conversion? Or just re-enable the conversion in the plugin?

-- ValentinKozlov - 24 Mar 2014

Thisi is an issue with Wysiwyg Editor I think TopicInteractionPlugin has added a feature that Wysiwyg can't support. We are not very good with handling names with embedded spaces in general. I didn't see any open tasks in WysiwygPlugin , so please open a task if you could. Thanks

-- GeorgeClark - 24 Mar 2014

I did. However, as you say - foswiki might not be very good with handling names with embedded spaces in general - points for me towards having the conversion, which removes spaces. At least to have it 'configurable' in the TopicInteractionPlugin.

-- ValentinKozlov - 25 Mar 2014

There already is a configure option for the core:

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

... which removes \s from the default.

-- MichaelDaum - 25 Mar 2014

Sorry, does not help. Neither

[\*?~^\$@%`"'&;|<>\[\]#\x00-\x1f]

nor

qr/[\*?~^\$@%`"'&;|<>\[\]#\x00-\x1f]/;

-- ValentinKozlov - 25 Mar 2014

If TopicInteractionPlugin is switched off, independen of '\s' present or not, files are renamed, i.e. spaces are replaced with '_'.

-- ValentinKozlov - 25 Mar 2014

Sorry, as I need a solution quite urgent, quick and dirty solution:

  1. go to lib/Foswiki/Plugins/TopicInteractionPlugin
  2. find Core.pm, function sub sanitizeAttachmentName
  3. add $fileName =~ s/\s+/_/g; (I did it before "Get rid of a subset of Namefilter")
now spaces in filenames are removed with "_" sign in TopicInteractionPlugin.

-- ValentinKozlov - 28 Mar 2014
 

QuestionForm edit

Subject Using an extension
Extension TopicInteractionPlugin, WysiwygPlugin
Version Foswiki 1.1.9
Status Task closed
Related Topics Tasks.Item12824
Topic revision: r9 - 09 Sep 2015, MichaelDaum
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