Reported by
TWiki:Main/BretHuang
on 2010-01-26 in
TWiki:Plugins/AttachmentListPluginDev
Suggested fix by Bret:
sub _formatFileData ,
#Due to sub web ex: QualityKM/Practice translate to QualityKM%2fPractice
# translate %2f back to /
$webEnc =~ s/\%2f/\//g ;
--
TWiki:Main/PeterThoeny
- 26 Jan 2010
Hello Peter and Bret, better to use
URI::Escape
than just regular expression suggested above.
Something like following fixes the issue
Index: AttachmentListPlugin.pm
===================================================================
--- AttachmentListPlugin.pm (revision 18314)
+++ AttachmentListPlugin.pm (working copy)
@@ -414,6 +414,9 @@
my $fileEnc = $fileData->{name};
$fileEnc =~ s/([^-_.a-zA-Z0-9])/sprintf("%%%02x",ord($1))/eg;
my $fileUrl = "$pubUrl/$webEnc/$topicEnc/$fileEnc";
+
+ use URI::Escape;
+ $fileUrl = uri_unescape($fileUrl);
$s =~ s/\$fileUrl/$fileUrl/g;
$s =~ s/\$fileTopic/$fileData->{topic}/g;
-- TWiki/Main.SopanShewale - 04 Feb 2010
The code is in repository.
-- TWiki/Main.SopanShewale - 11 Feb 2010